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.
[10:41 am]
v9bettel -- Nice
[01:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[10:50 pm]
Vrael -- Ultraviolet
Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
hey cut it out I'm getting all the minerals
[10:11 pm]
Ultraviolet -- :P
[10:11 pm]
Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
[2024-4-17. : 11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[2024-4-17. : 3:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
[2024-4-17. : 1:53 am]
Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
Please log in to shout.


Members Online: storuswhes, Roy