Repository navigation
Port fixes
Alexis Maiquez Murcia edited this page Dec 3, 2026
·
1 revision
These fixes make the ports behave like the original PC game. They are not bugs of PC's: PC doesn't have them,
because they come from running PC's code on another system (Linux, a 64-bit build, a GL ES or Vulkan renderer,
OpenAL, a modern compiler). They are either under #if defined(GTA_PORT) in src/, with PC's code in the #else, or
in the ports' own code under port/. None of them changes the matching builds.
Fixes of PC's own bugs are on the Fixes page (GTA_FIXES).
Which builds have these:
-
The Linux port (
port/linux/, i386, x86-64 and arm64): every fix here, except the ones marked otherwise. -
The IDE projects' Normal configuration (Win32 and x64) defines
GTA_PORT, so it has the fixes insrc/. -
The clang Windows exe (
tools/modern.py --link) has the renderer fixes when run on its OpenGL or Vulkan renderer (the same RWMBR code as the Linux port); its 64-bit build (--x64) also definesGTA_PORT.
For how the ports are built and what else they change, see docs/linux-port.md.
Contents
- Symptom: recruited homies, Ryder and Denise follow on foot but never get into the player's car, and don't fight back when the player is attacked.
-
Cause:
CFileMgrreturns theFILE *as a signed 32-bit handle, and PC's code tests it with<= 0for a failed open. On 32-bit Linux aFILEcan be allocated above 2 GB, so a file that opened looked like a missing one, and every.ped/.grpdecision maker stayed empty. PC's heap is below 2 GB. -
Fix: the ports'
CFileMgrhands out the pointer shifted right by one bit (lossless, as aFILEis aligned), and shifts it back in its other functions, so PC's sign tests on handles all work unchanged. -
Where:
src/Game/Core/FileMgr.cpp(GTA_PORT). - PR / issue: #4856 / #4849.
- Verified: with glibc forced to allocate high, before: the decision maker files read as not opened, then a crash; after: the decision makers load and a recruited homie boards the van.
- Frame-rate related: no.
- Symptom: cops (and other peds) aiming with their whole body could get NaN head and hand positions before they were first drawn, and fire along NaN lines of sight.
-
Cause:
RtAnimInterpolatorSetCurrentAnimwrites RenderWare's two key frame pointers where the animation blend frame keeps its rotation. On PC these are low heap addresses that read as tiny floats (the rotation stays the identity); on the i386 port they're high addresses that read as 1e18-1e24, and the first bone update gives NaN. -
Fix: the rotations are set back to the identity after
SetCurrentAnim. -
Where:
CClumpModelInfo::CreateInstance,src/Game/ModelInfo/ClumpModelInfo.cpp(GTA_PORT). - PR / issue: #4862 / #4843.
- Verified: a test scene in the Los Santos police station with cops and per-frame NaN checks on every ped: NaN lines in 5 of 6 runs before, none in 6 runs after (and none in 3 outdoor runs at 4 stars).
- Frame-rate related: no.
- Symptom: the 24/7 stores look empty (no shelves, products or shopkeeper); burglary houses and offices too.
-
Cause:
Interior_c::CalcMatrixmultiplies a matrix into itself (RwMatrixMultiply(&m, &m, ...)). PC's RenderWare uses its x87 assembly multiply, which reads each row whole before writing it. The ports use RenderWare's CMatrixMultiply, which overwrites values it then reads again, so the interior's furniture was placed 25 m away. -
Fix: the ports'
MatrixMultiplyworks row by row, as PC's assembly does. -
Where:
MatrixMultiply,src/RenderWare/src/plcore/bamatrix.c(GTA_PORT). - PR / issue: #4930 / #4927.
- Verified: side-by-side frames of a 24/7 store (GL ES 2 and Vulkan) against the Windows build under wine: after the fix the same shelves, products and fridges in the same places.
- Frame-rate related: no.
- Symptom: on x86-64 and arm64, UV-animated surfaces (for example the Four Dragons' neon signs) are dark and don't animate.
- Cause: RenderWare's UV animation reads the interpolated frame through the key frame structure. The data sits at the same offset only with 4-byte pointers, so with 8-byte pointers every field was read one float early.
- Fix: the interpolated frame's own structure is read.
-
Where:
RpUVAnimParamKeyFrameApply(src/RenderWare/plugin/uvanim/param.c) and the key frame macro insrc/RenderWare/plugin/uvanim/rpuvanim.c(GTA_PORT). - PR / issue: #4790 / #4719.
- Verified: 28 side-by-side scenes on a real GPU: i386 and x86-64 within run-to-run noise of each other after the fix.
- Frame-rate related: no.
- Symptom: light coronas (bollard lights, street lamps) are cut off by a straight line across the ground, hidden inside their lamp, or missing, depending on the camera angle.
- Cause: PC's RenderWare hands Im2D's screen z to Direct3D 9 as the depth value. The ports' Im2D passed it as GL's clip z (-1..1), so it reached the depth buffer at about twice the corona's distance and nearer geometry hid it.
- Fix: Im2D's projection maps z to 2z - 1, so the 2D depth reaches the depth buffer as itself.
-
Where:
port/linux/renderer/RWMBR/SDK/driver/mbr/baim2dgl.cpp(GL ES 2 and Vulkan share it). - PR / issue: #4934 / #4931.
- Verified: frames at the reported place and angles: the Windows build under wine draws the full glow; the port didn't before and does after.
- Frame-rate related: no.
- Symptom: the weapon icon (top right) disappears when flying the jet pack, and sometimes in aircraft.
- Cause: the icon is drawn at a screen z of 1 unit's depth, which goes below 0 once the camera's near clip is further than 1 (2 on the jet pack, up to 5 in aircraft). Direct3D 9 doesn't clip pretransformed vertices in z; GL clipped the icon at the near plane.
- Fix: the ports' Im2D holds screen z to 0..1, Direct3D 9's depth range.
-
Where:
port/linux/renderer/RWMBR/SDK/driver/mbr/baim2dgl.cpp. - PR / issue: #4940 / #4938.
- Verified: a test scene with the near clip forced to 2: the Windows build on real Direct3D 9 and under wine draws the icon; the port didn't before and does after.
- Frame-rate related: no.
- Symptom: CJ's real-time shadow is faint and points head first away from his feet.
- Cause: GL framebuffers start at the bottom row and Direct3D 9's at the top, and PC's code samples camera textures with Direct3D 9's coordinates. The ports' 2D passes already drew upside down; the 3D view didn't.
- Fix: the 3D view is turned upside down (with clockwise front faces) when drawing into a camera texture, as Im2D does.
-
Where:
_rwOpenGLCameraBeginUpdate,port/linux/renderer/RWMBR/SDK/driver/mbr/baintogl.cpp. - PR / issue: #4646 / #4636.
- Verified: frames with the shadow on and off: before, a head-first silhouette; after, one that starts at CJ's feet, with PC's strength.
- Frame-rate related: no.
- Symptom: CJ's real-time shadow sits about 20 cm off in each direction and has hard edges.
- Cause: Direct3D 9's pixel centres are at whole coordinates, GL's and Vulkan's half way. PC's shadow passes carry Direct3D 9's half-texel offset to blur by sampling between texels; in the port each pass sampled a texel centre instead, a copy one texel over with no blur.
- Fix: Im2D draws half a pixel right and down, and the 3D view is shifted the same half pixel, as Direct3D 9 draws.
-
Where:
port/linux/renderer/RWMBR/SDK/driver/mbr/baim2dgl.cpp,baintogl.cpp. - PR / issue: #4754 / #4744.
- Verified: the shadow texture's centre in three scenes: about 5 texels off the Windows build's before, within 0.2 after, on GL and Vulkan.
- Frame-rate related: no.
- Symptom: fog differed slightly from PC's (measured most clearly under water).
- Cause: PC asks Direct3D 9 for table fog, computed and clamped per pixel. The port clamped the fog factor per vertex.
- Fix: the unclamped factor is interpolated and clamped per pixel.
-
Where:
port/linux/renderer/RWMBR/SDK/rq/es2/RQES2ShaderBuilder.cpp. - PR / issue: #4711 / #4580.
- Verified: side-by-side against the Windows build under wine: the underwater scene's difference went from 1.5 to 0.8 (8x8-block means).
- Frame-rate related: no.
- Symptom: none tied to it for certain; on the GL renderer, a draw could use vertices that had already been written over, when the render queue flushed between setting up the draw and drawing it.
- Cause: a flush copied the vertices out of the queue but left GL's vertex attributes pointing into the queue, which is then written over.
- Fix: the copy re-points the enabled attributes at the copied vertices.
-
Where:
SetSafe,port/linux/renderer/RWMBR/SDK/rq/es2/RQES2Buffer.cpp(GL ES 2 only; Vulkan copies at the draw and wasn't affected). - PR / issue: #4801 / #4741.
- Verified: with a per-draw check and the queue's thread slowed after each flush: 97 draws read overwritten vertices before, 0 after.
- Frame-rate related: no.
- Symptom: none seen in play (a latent bug).
- Cause: the renderer's skinned-geometry reinstance path, taken from the Android version, writes skin data in the 3-weight layout, overwriting a 4-weight geometry's weights, and would have crashed reading a buffer already uploaded to the GPU.
- Fix: for a GPU-skinned geometry, the reinstance deletes the array and goes down the full instance path.
-
Where:
port/linux/renderer/RWMBR/SDK/plugin/skin2/mbr/skinmbr.cpp. - PR / issue: #4878 / #4848.
-
Verified: a unit test (
port/linux/tests/skin_reinstance.cpp). - Frame-rate related: no.
- Symptom: changing the resolution during play crashed the Linux port (heap corruption, or a crash in the GL driver).
-
Cause: the game resizes the camera raster without changing its stride, and the port's camera lock and raster
copy trusted the old size. On PC the window's synchronous
WM_SIZEalso resizes the camera before the post effects' buffer is sized; in the port that message came later. - Fix: the mode change sends the camera size before the post effects' buffer is set up, the camera lock takes its stride from the width, and the raster copy is clipped to its destination.
-
Where:
CSettings__SetCurrentVideoMode(port/linux/platform/osw_linux.cpp),port/linux/renderer/RWMBR/SDK/driver/mbr/baintogl.cpp,basprigl.cpp. - PR / issue: #4640 / #4637.
- Verified: mode changes up and down at 2560x1440, windowed and full screen: a crash at the first change before, none after.
- Frame-rate related: no.
- Symptom: in the clang Windows exe, after a resolution change in the menu, only a rectangle of the frame has the colour filter and the rest is darker or stretched.
-
Cause: the same ordering as above: the window layer covered the monitor without a mode change, so no
WM_SIZEof the new mode came and the post effects' buffer kept the old size. -
Fix: the window layer sends the mode's own
WM_SIZElast, as Direct3D 9's window would. -
Where:
PortWindowSetVideoMode,port/windows/renderer/window_win32.cpp(clang Windows exe only). - PR / issue: #4784 / #4780.
- Verified: under wine with Vulkan and OpenGL: a lit 1024x1024 rectangle before; evenly filtered frames at every change after.
- Frame-rate related: no.
- Symptom: voices and other sounds seemed to jump from one speaker to the other, especially between syllables.
- Cause: the port's EAX-on-OpenAL reverb was 7.8 dB too loud (the dry path's level was left out of the send, and a stereo source fed the reverb twice in phase), and OpenAL Soft's decorrelated reverb tails swung from side to side.
-
Fix: the 3D samples carry their -4.8 dB again, the send takes 1/√2, and both tails' pans are focused towards
the front (
GTASA_PORT_EAX_FOCUS, 0-1, sets how much). The presets' levels, delays and decays are unchanged. -
Where:
port/linux/audio/dsound_openal.cpp. - PR / issue: #4928 / #4923.
-
Verified: a test harness (
port/linux/tools/eaxtail.py) through the port's audio code: in five test cases the gaps between syllables went from 31-46 blocks leaning more than 3 dB to one side to 0-1. - Frame-rate related: no.
-
Symptom: the Linux port crashed (in
ReadFile) when starting a new game from the pause menu after loading a save. -
Cause: PC's own code reads from a file that failed to open (see "New game leaves the working directory" on the
Fixes page). Windows fails such a call with
ERROR_INVALID_HANDLE; the port's Win32 layer used the handle as a pointer. -
Fix:
ReadFile,WriteFile,SetFilePointer,GetFileSize,CloseHandle,FindNextFileAandFindClosefail withERROR_INVALID_HANDLEfor an invalid, closed or wrong-kind handle, as on Windows. -
Where:
port/linux/platform/win32.cpp; testport/linux/tests/win32_handles.cpp. - PR / issue: #4761 / #4758.
- Verified: the reported sequence scripted: a crash before, the new game starts after; the unit test runs in CI.
- Frame-rate related: no.
- Symptom: on x86-64 and arm64, taking a photo with the in-game camera crashes the game.
-
Cause: the game's
jpeglib.hdeclares libjpeg's structures with i386's layout. Against a 64-bit libjpeg, the structure size check fails and the error path writes past the game's error manager. -
Fix: the ports compile
jpeg.cppagainst libjpeg's own header. -
Where:
src/Game/jpeg/jpeglib.h(GTASA_PORT_IJG_JPEGLIB, set byport/linux/CMakeLists.txt). - PR: #4777.
-
Verified: on x86-64, a photo taken under a debugger: a crash before; a valid
gallery1.jpgafter. - Frame-rate related: no.
- Symptom: the port crashed at start-up right after the renderer started (unoptimised builds), or could race on the gamma table (optimised builds, where the compiler may drop the call).
- Cause: the gamma ramp's lock and unlock functions called themselves instead of locking their mutex.
- Fix: they lock and unlock the mutex.
-
Where:
port/linux/renderer/glue/rwmbr_os.cpp. - PR: #4757.
- Verified: an unoptimised x86-64 build that crashed before runs through the logo movie into the game.
- Frame-rate related: no.
- Symptom: on x86-64 and arm64 with any pad attached, CJ ran off by himself, movies were skipped, and a teleported player wouldn't stay put.
-
Cause: the port's stand-in
dinput.hspelledDIPROP_RANGEas DirectInput does, a reference to address 4. That is undefined behaviour, and clang compiled the pad'sSetPropertyto a bare "not implemented", so the axes stayed at 0..65535 and a centred stick read as pushed. -
Fix: the property ids are real
GUIDobjects (andGUIDis 16 bytes on 64-bit builds too). -
Where:
port/linux/include/prerelease/dinput.h,port/linux/include/guiddef.h,port/linux/platform/dinput_port.cpp. - PR / issue: #4790 / #4719.
- Verified: play on x86-64 with a pad, and under qemu on arm64: the player stays in place.
- Frame-rate related: no.
-
Symptom: a
gta_sa.setcopied from a Windows install lost its key bindings on the port's first start. -
Cause: when the start-up selection window's resolution differed from the file's, the port saved the settings at
once, before the controls had been read from the file, writing the default controls over them. PC's
WinMainmakes no save at that point. - Fix: the change is only marked, and saved after the controls are read.
-
Where:
psSelectDeviceandWinMain,port/linux/platform/osw_linux.cpp. - PR: #4760.
-
Verified: with a copy of a Windows
gta_sa.set: 9 bindings reset before; the controls section identical to the Windows file after. - Frame-rate related: no.
-
Symptom: the IDE projects' Normal x64 configuration couldn't link: there is no x64
ddraw.libin the Windows SDK 7.0A/7.1 or the June 2010 DirectX SDK. -
Cause:
ddrawGetAvailableVidMemcallsDirectDrawCreateExdirectly. -
Fix: on 64-bit Windows builds it gets
DirectDrawCreateExfromDDRAW.DLLat run time, asGetDirectXVersionalready does. -
Where:
ddrawGetAvailableVidMem,src/Game/win/osw.cpp(GTA_PORTand_WIN64). - PR / issue: #4920 / #4900.
- Verified: VS2010 and VS2025 Normal x64 build on Windows 11, the exe has no DDRAW.dll import, and the game reaches Grove Street.
- Frame-rate related: no.