RobertBeckebans / RBDOOM-3-BFG

Doom 3 BFG Edition source port with updated DX12 / Vulkan renderer and modern game engine features
https://www.moddb.com/mods/rbdoom-3-bfg
GNU General Public License v3.0
1.37k stars 244 forks source link

Fix crash regression in Bink Decoder when file cannot be opened #875

Closed SRSaunders closed 1 month ago

SRSaunders commented 1 month ago

Fixes a crash regression in Bink Decoder when the path is missing or not a bink file. This can be observed when using the testVideo console command and mistyping a file name. The regression comes my previous memory leak fixes that freed Bink bundles when closing playback. Unfortunately I did not properly check for unallocated bundles with NULL pointers caused by failed open requests. This PR fixes that oversight.

In addition, this adds a small change to testVideo playback that checks if the console is open or closed the view is 2D or 3D, and only skips sRGB to linear conversion if the console is open (i.e. a 2D surface) view is 2D. If the console is closed and a 3D game is running, then normal shaders are used for testVideo to get as close as possible to proper colors. However, this is not perfect since other 3D processing occurs afterwards - i.e. TAA, Tonemapping, etc. A minor improvement but I thought I would add it here.

RobertBeckebans commented 1 month ago

Checking wether the console is open or not is wrong. You need the sRGB variant if viewDef->viewEntitys is NULL because then we render to the 8 bit ldrFBO and not the hdrFBO.

SRSaunders commented 1 month ago

Dumb mistake on my part. I was using console as a proxy for 2D/3D, but not needed when you can test it directly. Fixed.

RobertBeckebans commented 1 month ago

Heh you are definitely not dumb. Merged it.