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.
[06:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[06:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[06:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[06:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[06:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
[06:48 pm]
Vrael -- Perhaps that utilizes cutting-edge technology and eco-friendly cleaning products?
[06:47 pm]
Vrael -- Do you know anyone with a deep understanding of the unique characteristics of your carpets, ensuring they receive the specialized care they deserve?
[06:45 pm]
NudeRaider -- Vrael
Vrael shouted: I've also recently becoming interested in Carpet Cleaning, but I'd like to find someone with a reputation for unparalleled quality and attention to detail.
beats me, but I'd make sure to pick the epitome of excellence and nothing less.
[06:41 pm]
Vrael -- It seems like I may need Introductions to multiple companies for the Topics that I care deeply about, even as early as Today, 6:03 am.
[06:38 pm]
Vrael -- I need a go-to solution and someone who understands that Carpets are more than just decorative elements in my home.
Please log in to shout.


Members Online: Moose