mod icon Created 2 months ago2018-11-24 06:31:26 UTC by tschumann tschumann

Created 2 months ago2018-11-24 06:31:26 UTC by tschumann tschumann

Posted 2 months ago2018-11-24 06:31:26 UTC Post #341308
I've copied game.tga from Half-Life to use in my mod and in paint.net I've tried saving it with various different settings (24-bit, 32-bit, with and without RLE compression) but whatever I do, I end up with the icon rotated 180 degrees in the menu bar and task bar of Windows.
Anyone had anything similar? Or any other ideas to try?
Posted 2 weeks ago2019-02-01 14:00:14 UTC Post #341904
Does the .ico not work?
Posted 2 weeks ago2019-02-01 15:22:02 UTC Post #341906
The Valve Dev Wiki says your icon must be an uncompressed 24-bit TGA file, 16x16 pixels in size and you must not include the .tga file extention in your liblist.gam file.

What's weird though, the singleplayer mod Half-Life Echoes uses a 32-bit icon file. It also has the same icon but as an actual icon (.ico file) file.
Focal Point has .ico and tga icon files, both are 32x32 pixels and are 32-bit. What. :nuts:

So it's a little bit unclear what the rules for mod icons are. I've never had my mod icons rotated 180 degrees though. Maybe Paint.net is saving your tga's in a different tga format that Half-Life/Steam can't read correctly. Other than that, I have no clue.
The Mad Carrot The Mad CarrotMad Carrot
Posted 2 weeks ago2019-02-01 23:21:30 UTC Post #341915
I think the .ico is only used for desktop shortcuts.

Re the Valve Developer wiki - I think I updated that page (probably a decade or so ago) and it worked back then but Steam has received more than a few updates since then.
I've been trying to copy what Half-Life itself has but I suspect games/mods have an icon on the Steam backend that gets used for the Steam My Games list.
I tried updating paint.net but had no luck, and as far as I can see my .tga has the same settings as Half-Life's icons, and the Windows preview shows the correct orientation.
Posted 2 weeks ago2019-02-02 02:32:02 UTC Post #341917
Just out of curiosity, could you send me your tga file so I can see if that rotation happens on my end as well?
The Mad Carrot The Mad CarrotMad Carrot
Posted 2 weeks ago2019-02-02 03:56:16 UTC Post #341918
You can grab it out of the .zip at (https://www.moddb.com/mods/sandpit/downloads/sandpit-v401).
I've since tried playing around with it locally but still get the same result.
Posted 2 weeks ago2019-02-02 16:53:51 UTC Post #341926
So I did some experimenting with your icon, but whatever I do, the icon is always rotated 180 degrees in the taskbar and I can't figure out why. Maybe it is a Windows or Steam issue.

Also I think having an actual ico file in your mod folder is unnecessary, unless you want a desktop shortcut of your mod. Otherwise a single tga file is all you need.

I did however figure out that if you create two tga versions of your mod icon, one 16x16 file named 'game' and one 32x32 file named 'game_big', or any name for that matter as long as it has the '_big' suffix added to it's filename, Steam will use the 16x16 icon in the library list and the 32x32 file on the game page (when selected).

I'm out of ideas for now, maybe any one else has a solution?
User posted image
Dang Focalpoint and your oversized icon. :nuts:
The Mad Carrot The Mad CarrotMad Carrot
Posted 2 weeks ago2019-02-02 17:44:47 UTC Post #341927
The engine seems to intentionally flip the image vertically, but i don't know why. I don't know why the original icon works either.
Posted 2 weeks ago2019-02-02 23:07:24 UTC Post #341933
Alright thank you both - I was convinced it had to be the engine because I couldn't believe that both paint.net and Windows would both be wrong.
But I don't get how games through Steam don't have this problem.
Posted 2 weeks ago2019-02-03 00:17:58 UTC Post #341937
They probably get their icons from the executable files as icons can be embedded in those.
The Mad Carrot The Mad CarrotMad Carrot
Posted 2 weeks ago2019-02-03 08:18:51 UTC Post #341940
Maybe, though I didn't think all the different game icons were embedded.
I think it's Steam magic but I don't know.
Posted 2 weeks ago2019-02-03 11:52:04 UTC Post #341942
Nope, the engine only loads game.tga, and it uses the engine filesystem to load it. So by default it's valve/game.tga, but if your mod has one it'll use that instead.

I'm guessing the tga file is saved in such a way that it appears normal in viewers but gets read upside down by the engine and then flipped.
Posted 2 weeks ago2019-02-03 17:38:09 UTC Post #341947
Here's how to save the image correctly using GIMP:
Then add icon "game" to your liblist.gam. The icon will then display correctly both in Steam and the Half-Life window header / taskbar icon.

The "Origin: Top left" option is what does it. I guess the technical reason is that either Windows or Half-Life (whichever is responsible for interpreting the TGA) doesn't care about the part of the file header that says which order the pixels are in. So we need to use the expected order.
potatis_invalid potatis_invalidh̲͚̤̿͑̔̒̃̉̓ȋ͂͋̉̿̎͋̈́͏͚͖͇̭̩͓͔͝
Posted 2 weeks ago2019-02-03 21:12:53 UTC Post #341948
Right. So how do you save the tga file with the correct origin in Photoshop? Don't tell me I have to get Gimp just for this purpose?
The Mad Carrot The Mad CarrotMad Carrot
Posted 2 weeks ago2019-02-03 22:16:28 UTC Post #341949
No idea, unfortunately
potatis_invalid potatis_invalidh̲͚̤̿͑̔̒̃̉̓ȋ͂͋̉̿̎͋̈́͏͚͖͇̭̩͓͔͝
Posted 2 weeks ago2019-02-03 22:59:37 UTC Post #341950
It happened the same to me when i was making my mod, i think is a steam glitch or something. I'm gonna suggest a simple solution, just turn your icon upside down, the game will do the same when you load it and the icon should look fine.
User posted image
EDIT: Jesus, i just realised this thread is from two months ago, maybe this was unnecessary.
Posted 2 weeks ago2019-02-04 15:09:40 UTC Post #341957
I wrote a script you can use if you don't want to install GIMP. Just drag and drop a PNG, GIF, SVG, JPEG, WebP, or TIFF (ironically enough not TGA) onto image_to_hl_game_tga.bat and it will create a game.tga which works fine with both Half-Life and Steam. Let me know if you have any trouble using it. If you want to try different image dimensions, edit index.js (the const width and const height lines).

https://github.com/oskarlh/hltga/releases
Remember to add icon "game" to your liblist.gam if you want it to show up in Steam.

Edit: Added to the wiki

Edit 2: Turns out compression works (even Half-Life's valve\game.tga is compressed), the information on Valve's wiki is outdated. Also, the file can have any reasonable resolution, but should be 32x32 if you want to use the same file for Steam's game list.
potatis_invalid potatis_invalidh̲͚̤̿͑̔̒̃̉̓ȋ͂͋̉̿̎͋̈́͏͚͖͇̭̩͓͔͝
Posted 2 weeks ago2019-02-05 16:58:00 UTC Post #341973
Ah nice, thanks, that should come in handy even for me. :)
The Mad Carrot The Mad CarrotMad Carrot
Posted 1 week ago2019-02-09 04:30:24 UTC Post #341994
Oh nice potatis_invalid - I might just try flipping that bit and hope that that works.
Posted 1 week ago2019-02-09 07:29:14 UTC Post #341995
@potatis_invalid does your tool reverse the order of the pixel rows as well as setting the direction bit? I tried just setting the direction bit (which apparently makes it an invalid .tga according to the spec) and Windows shows it as upside down.
Posted 1 week ago2019-02-09 08:22:59 UTC Post #341996
It writes them in the required order, which is the reverse order of most TGA files, but the same order as most image files of other formats in my experience. By default most simple image formats keep rows of pixels top-to-bottom. It seems TGA is the exception, though has the capability through certain header fields to store pixel rows top-to-bottom, too. My tool does this, and this makes the icon display correctly in Half-Life as well as anywhere else like Steam.

You're correct that the direction bit (1<<5 in byte 17) should be set, there's also bytes 10-11 which should contain the height as a 16-bit little endian integer, having the same values as bytes 14-15. https://github.com/oskarlh/hltga/blob/master/scripts/index.js#L29
potatis_invalid potatis_invalidh̲͚̤̿͑̔̒̃̉̓ȋ͂͋̉̿̎͋̈́͏͚͖͇̭̩͓͔͝
Posted 1 week ago2019-02-09 22:04:50 UTC Post #342003
Ah yep, didn't think about x/y-origin fields - thanks.
You must be logged in to post a response.