Staredit Network > Forums > Modding Assistance > Topic: How does SC load images?
How does SC load images?
Jun 19 2015, 11:10 pm
By: iCCup.xboi209  

Jun 19 2015, 11:10 pm iCCup.xboi209 Post #1



Can someone tell me how SC loads images from the mpq files? Does it use one of the functions from Storm.dll? Which address is function to load the image is at?



None.

Jun 21 2015, 4:57 pm Neiv Post #2



Do you mean pcx or images.dat/grp images? Pcx images are loaded using storm function #321, SBmpDecodeImage.

Images.dat iscript.bin, and any .lo, and .grp files are loaded to the memory by function located at 004D7180 (1.16.1 address, no arguments, returns nothing), which is called once during the loading screen before main menu. The .grps are not decoded there though, decoding is done every time an image has to be drawn on the screen.



None.

Jun 21 2015, 7:15 pm iCCup.xboi209 Post #3



Oh i just realized i wasn't clear on my first post. I meant the pcx graphics. I don't think I'm looking for the decoding function, something more like loading the file into memory like Load(data.mpq, "Dir1/Dir2/file.pcx)




Jun 21 2015, 8:12 pm Neiv Post #4



Well, all of the files (maybe not .smks) are opened through combination of SFileOpenFileEx and SFileReadFile, is that what you need?
There is an function located at 004D2D10 which does the tedious work and returns a pointer to the file, but it's not used for all pcx files while being used for other unrelated data files:
Quote
004D2D10 = ReadMpqFile(), arg 1 char *chk_path, arg 2 unk, arg 3 unk, arg 4 char *source_file, arg 5 source_line, ecx open_mode, eax dword *out_filesize (Returns void *file)

Some of the pcx files (at least ofire.pcx and other remapping palettes) are just read with the function above and decoded with SBmpDecodeImage, but there is also Storm function #323 SBmpLoadImage, which is used at least when loading the player color pcx.
Can't really tell how it differs - it seems to do both mpq reading and decoding at once, but requires a buffer large enought to fit the uncompressed image, so it is only used when engine knows the image size beforehand?

Also menu images use function #325 SBmpAllocLoadImage, which seems to be the "best" pcx loading function, doing mpq access, memory allocation and and decoding - can't tell what parameters to pass there though.

All of those ways call SFile functions internally though to read from mpqs, if you wish to specify the mpq to read from you'll need to call SFileOpenFileEx by yourself, as the functions mentioned search all of the mpqs that have been loaded with SFileOpenArchive.

..was this even close to what you wished to know?



None.

Jun 22 2015, 1:25 am iCCup.xboi209 Post #5



Yes thank you, I'll look into all of those



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2024-4-22. : 6:48 pm]
Ultraviolet -- :wob:
[2024-4-21. : 1:32 pm]
Oh_Man -- I will
[2024-4-20. : 11:29 pm]
Zoan -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
You should do my Delirus map too; it's a little cocky to say but I still think it's actually just a good game lol
[2024-4-20. : 8:20 pm]
Ultraviolet -- Goons were functioning like stalkers, I think a valk was made into a banshee, all sorts of cool shit
[2024-4-20. : 8:20 pm]
Ultraviolet -- Oh wait, no I saw something else. It was more melee style, and guys were doing warpgate shit and morphing lings into banelings (Infested terran graphics)
[2024-4-20. : 8:18 pm]
Ultraviolet -- Oh_Man
Oh_Man shouted: lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
oh ya I saw that when Armo posted it on Discord, pretty crazy
[2024-4-20. : 8:09 pm]
Vrael -- thats less than half of what I thought I'd need, better figure out how to open SCMDraft on windows 11
[2024-4-20. : 8:09 pm]
Vrael -- woo baby talk about a time crunch
[2024-4-20. : 8:08 pm]
Vrael -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
so that gives me approximately 27 more years to finish tenebrous before you get to it?
[2024-4-20. : 7:56 pm]
Oh_Man -- lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
Please log in to shout.


Members Online: Zycorax