Answer the question
In order to leave comments, you need to log in
How to approach storage of heavy resources in an executable file?
There was a need to store large resources in single executable files. In particular, MSVC is used in conjunction with Qt. The standard Qt and Win API resource schemes are not suitable, since it is strongly undesirable to load resources into memory - ideally, they should be read in parts from the executable file.
An example is the self-extracting archives that 7-zip and WinRar create. I would like to achieve the same effect at the build stage, without resorting to post-processing of executable files and parsing their structure during execution.
Answer the question
In order to leave comments, you need to log in
A great solution was suggested by amirul :
I really dislike tens of megabyte executable files, but since you have already decided to use them anyway, and the only decision left to make is, in fact, how, then use the resources and don’t fool around. Windows just uses mapping to load executable files with page demand paging at the time of access.Those. the standard Windows scheme is still suitable for these purposes.
Well, and you tried according to the RARJPEG principle - to glue the resources with the executable file.
And then, in the process of loading, by tags in the file, find reurs and work with them
An example is the self-extracting archives that 7-zip and WinRar create.
They work like this: at the end of the PE file, after everything, the actual archive is appended at the end. The program opens its own EXE for reading and looks for the archive header without bothering to parse the PE file itself.
It would be nice for you to find, for example, how WoW works with its resources, there are resources of a hoo Gigabyte, and it doesn’t keep everything in memory.
As options:
- make your own archive format,
- shove some kind of database into BLOBs and then read them from there
- make zip - with coef. compression 0 to quickly unpack and load into memory
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question