Skip to content

Three small fixes: DXT capability check, corona decal clamp, Vanilla link break - #33

Open
18woldemar wants to merge 3 commits into
mrxenginner:miamifrom
18woldemar:upstream-fixes
Open

Three small fixes: DXT capability check, corona decal clamp, Vanilla link break#33
18woldemar wants to merge 3 commits into
mrxenginner:miamifrom
18woldemar:upstream-fixes

Conversation

@18woldemar

@18woldemar 18woldemar commented Aug 4, 2026

Copy link
Copy Markdown

Three unrelated one-file fixes; happy to split them into separate PRs if you would rather.

CanVideoCardDoDXT answers "no" on OpenGL whatever the card can do

It is a // TODO in TexRead.cpp, and the "no" is not free. CStreaming::Init then builds
MODELS\TXD.IMG, repacking every texture dictionary out of its D3D8 container, and because
TXD.DIR is scanned before GTA3.DIR that copy is what gets read from then on — the
originals are shadowed.

On retail PC data that is 1360 dictionaries, ~180 MB of duplicate on disk and a conversion
pass on first run, for a card that could have read the originals directly. The textures
there really are DXT1 (platform 8, compression 1, read out of the archive headers) and the
rewrite is size-for-size, so nothing is lost to it — it is simply unnecessary work on any
desktop GL driver.

GetGPUcaps already asks librw the same question, so this asks it here too. Desktop GL has
S3TC; a GLES device without it still takes the conversion path.

Checked by hiding models/txd.img and txd.dir from a run: the game starts, plays and
quits normally and does not rebuild them.

Corona pool decal colour can wrap (behind FIX_BUGS)

CShadows::StoreStaticShadow takes red/green/blue as uint8 and nothing bounds them on the
way in, so a value past 255 wraps rather than clipping and the decal comes out dark instead
of merely too bright.

Being straight about the scope: retail data does not reach it. col.r and
shadowIntensity are both uint8, and CTimeCycle::GetSpriteBrightness is timecyc.dat's
sprBght, which tops out at exactly 1.00 across all 168 rows — so the product lands on
255.0 and stops. It is reachable from data, though: the parser stores sprBght*10 in an
int8, so anything above 1.0 puts a bright lamp over. Guarded, with the original arithmetic
kept in the #else.

The Vanilla configuration does not link

channel.cpp references gPlayerTalkDataSize unconditionally while sampman_oal.cpp only
defines it behind FIX_BUGS, so a build with the fixes off fails:

error LNK2001: unresolved external symbol "unsigned int gPlayerTalkDataSize"

This is visible in this repository's own CI — the premake x86 workflow builds Vanilla and
has been red on it. Not caused by the two changes above; included here so the PR's own CI
can go green. Guarded on both sides.

Built on Linux (librw / GL3 / OpenAL) and on Windows through the repo's MSVC workflow.

CanVideoCardDoDXT is a TODO that answers "no" on OpenGL whatever the hardware supports, and
answering no has a cost: CStreaming::Init then builds MODELS\TXD.IMG, repacking every
texture dictionary out of its D3D8 container, and since TXD.DIR is scanned before GTA3.DIR
that copy is what gets read from then on - the originals are shadowed.

On retail PC data that is 1360 dictionaries, about 180 MB of duplicate on disk and a
conversion pass on first run, for a card that could have read the originals directly. The
textures really are DXT1 there (platform 8, compression 1, read out of the archive headers)
and the rewrite is size-for-size, so nothing is lost to it - it is simply unnecessary work
on any desktop GL driver.

GetGPUcaps already asks librw the same question, so ask it here too. Desktop GL has S3TC; a
GLES device without it still gets the conversion path it needs.

Checked by hiding models/txd.img and txd.dir from a run: the game starts, plays and quits
normally and does not rebuild them.
CShadows::StoreStaticShadow takes red, green and blue as uint8 and nothing bounds them on
the way in, so a value past 255 wraps rather than clipping - the decal comes out dark
instead of merely too bright.

Retail data does not reach it: col.r and shadowIntensity are both uint8, and
CTimeCycle::GetSpriteBrightness is timecyc.dat's sprBght column, which tops out at exactly
1.00 across all 168 rows, so the product lands on 255.0 and stops. It is reachable from
data, though - the parser stores sprBght*10 in an int8, so anything above 1.0 puts a bright
lamp over the edge.

Guarded, with the original arithmetic kept in the other arm.
channel.cpp references gPlayerTalkDataSize unconditionally, while sampman_oal.cpp only
defines it behind FIX_BUGS - so any build with FIX_BUGS off, which is what the Vanilla
configuration is, fails at link:

    error LNK2001: unresolved external symbol "unsigned int gPlayerTalkDataSize"

It shows up in this repository's own CI, where the Windows x86 workflow builds Vanilla.
Guarded on both sides; with the fix off the temp stereo buffer is sized from PED_BLOCKSIZE
alone, which is what the code did before the player-comment buffer existed.
@18woldemar 18woldemar changed the title Two small fixes: DXT capability check, corona decal colour clamp Three small fixes: DXT capability check, corona decal clamp, Vanilla link break Aug 4, 2026
18woldemar added a commit to 18woldemar/reVC that referenced this pull request Aug 4, 2026
Everything from the CI day: the workflows unrotted and moved to release-only triggers, the
tag-driven release rule with its draft and its attach step, the signing key as a secret,
Jolt building on Windows and the Switch, and the two bugfixes that went upstream as PR mrxenginner#33.

Four conflicts, all expected:

- build.gradle and app/CMakeLists.txt take vercetti's version handling. That is the whole
  point of the change - the tag is the only place the version lives, and both files used to
  hold a copy of it.
- Coronas.cpp and TexRead.cpp keep STARFISH's shape. Both fixes already live here in their
  own form, and Coronas' has the DYNAMIC_LIGHTS gate wrapped around the same block, which
  taking vercetti's version would have dropped - this branch has dynamic lights and that
  branch does not.

Ragdoll suite green, graphics suite green - 44 of 44, including the pixel checks, which is
what says the librw fork is the one that got built.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant