View Issue Details

IDProjectCategoryView StatusLast Update
0004488The Dark ModGUIpublic23.04.2021 07:14
ReporterAluminumHaste Assigned Tostgatilov  
PrioritynormalSeveritynormalReproducibilityalways
Status resolvedResolutionfixed 
Platformx86-64OSWindowsOS Version7
Product VersionTDM 2.05 
Fixed in VersionTDM 2.09 
Summary0004488: Image previews are sometimes black
DescriptionSome missions shots are completely black.
Checking the console shows that it can't load previewshot_gatehouse_2014-01-29_19.24

Checked the _missionshots folder and the name is:
previewshot_gatehouse_2014-01-29_19.24.32859.jpg

The filename parsing is completing on the first period.


Steps To ReproduceOpen TDM
Download Missions
Select Gatehouse
Click "More..." button

Screenshots show black.

Check console shows

WARNING: Couldn't load image: fms/_missionshots/previewshot_gatehouse_2014-01-29_19.24

Additional InformationThe ideal fix would be a code change in filename parser, as this might affect other parts of the engine elsewhere.

Otherwise, all screenshots that were uploaded to mission database would have to be downloaded, renamed, re-uploaded.
TagsNo tags attached.
Attached Files
screenshot.png (1,423,133 bytes)
screenshot2.png (1,158,436 bytes)
screenshot3.png (420,665 bytes)
screenshot4.png (76,416 bytes)   
screenshot4.png (76,416 bytes)   
screenshot5.png (31,838 bytes)   
screenshot5.png (31,838 bytes)   
FIXED.png (2,081,048 bytes)

Relationships

related to 0005020 resolvedstgatilov The Gatehouse mission lacks screenshots on the mission downloader 

Activities

AlexDiru

AlexDiru

30.07.2017 16:55

reporter   ~0009039

Last edited: 30.07.2017 16:58

See screenshot.png for some idea of what is happening. The images are downloading from the server correctly, but not being rendered properly. Going to check some other missions where the images load correctly and see if there is any difference with what is downloaded.

Full Moon Fever works correctly, and it saves the image to same location (__missionscreenshot.temp). So it is something happening between downloading the temp page and displaying it on the GUI

Also I have a really bad keyboard which doesn't let me open the console (even with rebound keys in the config file... New one should arrive on Monday and will help debugging)

AlexDiru

AlexDiru

02.08.2017 10:21

reporter   ~0009040

Got the console working with this new keyboard, wish the warning message would tell me which file it was from. But I will look at this again today
AlexDiru

AlexDiru

02.08.2017 11:54

reporter   ~0009041

More progress:
https://pastebin.com/icncMgbf
Starts off with the stack of where FAILED TO LOAD IMAGE is called from

Currently debugging the Script_Set function, but not easy
AlexDiru

AlexDiru

02.08.2017 17:09

reporter   ~0009042

Screenshot 2 shows the image failing to load when the extension is forced on it
Screenshot 3 shows the image failing to load when the absolute path and extension are forced on it.

Maybe it's something inside R_LoadImageProgram not liking all the periods in the filename
AlexDiru

AlexDiru

02.08.2017 17:16

reporter   ~0009043

Screenshot 4 shows where the lexer is reading the filename incorrectly! We are getting there!

Screenshot 5 shows it reading correctly (from Exhumed FM)
AlexDiru

AlexDiru

02.08.2017 18:20

reporter   ~0009044

R_ParseImageProgram_r calls idLexer::ReadToken twice when 'More' is pressed for The Gatehouse

Works correctly the first pass
Works incorrectly the second pass

src.buffer (\n replaced by actual newlines to increase readability)

material fms/_missionshots/previewshot_gatehouse_2014-01-29_19.24.32859 // IMPLICITLY GENERATED
{
\t{
\tblend blend
\tcolored
\tmap \"fms/_missionshots/previewshot_gatehouse_2014-01-29_19.24.32859\"
\tclamp
...

The difference is the quotes around the filename in the one that fails
ReadName is being called for the first one
ReadString is being called for the one wrapped in quotes
AlexDiru

AlexDiru

02.08.2017 19:13

reporter   ~0009045

May have gotten ReadName and ReadString the wrong way around.

I have added LEXFL_ONLYSTRINGS to R_LoadImageProgram as the filename has hyphens in. This nearly solves the problem, but it's still having trouble with the extension
AlexDiru

AlexDiru

02.08.2017 19:18

reporter   ~0009046

The think the next problem is DefaultFileExtension in R_LoadImage due to the periods in the files
AlexDiru

AlexDiru

02.08.2017 19:27

reporter   ~0009047

I DID IT!!!

Going to clean up code and send patch

This took way longer than expected

Fix is slightly hacky though
nbohr1more

nbohr1more

05.10.2017 13:33

developer   ~0009397

Patch?
nbohr1more

nbohr1more

17.10.2017 15:14

developer   ~0009509

Ping
AluminumHaste

AluminumHaste

17.10.2017 15:32

developer   ~0009515

I sent him a PM on the forums, hopefully he sees it.
grayman

grayman

13.12.2017 15:10

viewer   ~0009775

So we're waiting for AlexDiru to provide us his 4-month-old 'slightly hacky' patch to fix this problem?
AluminumHaste

AluminumHaste

13.12.2017 15:17

developer   ~0009776

Looks like.
grayman

grayman

13.12.2017 15:38

viewer   ~0009777

I will look at this problem.
grayman

grayman

14.12.2017 08:24

viewer   ~0009781

Last edited: 14.12.2017 08:24

Gatehouse's preview picture filenames have a different format than those for other missions.

I.e. here's a Gatehouse picture:

previewshot_gatehouse_2014-01-29_19.23.20420.jpg

And here's one from NHAT:

previewshot_anoott_4143.jpg

If there's any number of dots before the file extension, it screws up loading the picture.

It looks like the correct fix is to fix the filenames.

grayman

grayman

14.12.2017 14:47

viewer   ~0009782

This problem will be fixed by changing the names of the preview pictures to remove the extraneous dots.

No point in futzing with low-level TDM code, trying to accommodate the dots.
stgatilov

stgatilov

26.07.2020 13:45

administrator   ~0012680

Indeed, we should not change the common image loading code in the engine.
Too much depends on it, and too many obstacles to make it work with bad names.

Instead, I simply added some code to sanitize screenshot filenames in svn rev 8892.
For example, here is a name of screenshot file saved for Gatehouse:
  previewshot_gatehouse_2014_01_29_19_24_32859.jpg
As you see, all dots and hyphens (and other bad chars) are replaced with underscores.

Followed by minor refactoring in svn rev 8893.

Issue History

Date Modified Username Field Change
05.03.2017 14:20 AluminumHaste New Issue
30.07.2017 16:54 AlexDiru File Added: screenshot.png
30.07.2017 16:55 AlexDiru Note Added: 0009039
30.07.2017 16:57 AlexDiru Note Edited: 0009039
30.07.2017 16:58 AlexDiru Note Edited: 0009039
02.08.2017 10:21 AlexDiru Note Added: 0009040
02.08.2017 11:54 AlexDiru Note Added: 0009041
02.08.2017 17:09 AlexDiru Note Added: 0009042
02.08.2017 17:09 AlexDiru File Added: screenshot2.png
02.08.2017 17:10 AlexDiru File Added: screenshot3.png
02.08.2017 17:16 AlexDiru Note Added: 0009043
02.08.2017 17:17 AlexDiru File Added: screenshot4.png
02.08.2017 17:17 AlexDiru File Added: screenshot5.png
02.08.2017 18:20 AlexDiru Note Added: 0009044
02.08.2017 19:13 AlexDiru Note Added: 0009045
02.08.2017 19:18 AlexDiru Note Added: 0009046
02.08.2017 19:27 AlexDiru Note Added: 0009047
02.08.2017 19:28 AlexDiru File Added: FIXED.png
05.10.2017 13:33 nbohr1more Note Added: 0009397
17.10.2017 15:14 nbohr1more Note Added: 0009509
17.10.2017 15:32 AluminumHaste Note Added: 0009515
13.12.2017 15:10 grayman Note Added: 0009775
13.12.2017 15:17 AluminumHaste Note Added: 0009776
13.12.2017 15:38 grayman Note Added: 0009777
14.12.2017 08:24 grayman Note Added: 0009781
14.12.2017 08:24 grayman Note Edited: 0009781
14.12.2017 14:47 grayman Note Added: 0009782
14.12.2017 14:48 grayman Assigned To => grayman
14.12.2017 14:48 grayman Status new => resolved
14.12.2017 14:48 grayman Resolution open => no change required
14.12.2017 14:48 grayman Target Version TDM 2.06 =>
26.07.2020 13:45 stgatilov Note Added: 0012680
26.07.2020 13:46 stgatilov Assigned To grayman => stgatilov
26.07.2020 13:46 stgatilov Status resolved => assigned
26.07.2020 13:46 stgatilov Status assigned => resolved
26.07.2020 13:46 stgatilov Resolution no change required => fixed
26.07.2020 13:46 stgatilov Fixed in Version => TDM 2.09
23.04.2021 07:14 stgatilov Relationship added related to 0005020