The extraction issue has been resolved with QuickBMS, so this part of the task is already kind of done. But QuickBMS can't properly pack back, it's written in their manual that packing is an experimental feature.
I decided to write my hand-written code in PHP, it makes packaging ideally convenient - just put any files in the FILES folder, even in formats not compatible with the game, and a ready-made one appears in the OUTPUT folder sc2000.dat file to feed it to the game (the game simply ignores extra files, the load order is not important).
As a result, I managed to make a release that starts with 2250 kilobytes of free RAM, but it turns out to be completely empty in terms of music and sounds, and even with limited zoom (zooming in the game to the maximum). The release for free 2.5 megabytes is better - there is no zoom limit. One way or another, the goal is almost reached.
The instruction is something like this (may differ from the last release, but the action plan is clear):
1) The game starts with the keys NO_INTRO NO_MEM_CHK (there is no need for the INTRO.RAW file and we turn off the free memory check)
2) TITLE.RAW can also be deleted
3) Delete *.XMI, leave one file with 10.XMI music and edit %d.XMI to 10.XMI inside SC2000.EXE
4) Delete *.VOC, leave one file with sound 11.VOC and inside SC2000.EXE edit %d.VOC to 11.VOC
5) Delete PAPER*, leave one PAPER7 file and edit PAPER.. to PAPER7 inside SC2000.EXE.
6) Delete TXT*, leave one file TXT11 and edit TXT%d inside SC2000.EXE. on TXT11
7) Delete ABOUT*.RAW, PPDT*.RAW, NEWYRK*.FNT, POP*.RAW
8] For the version requiring a maximum of 2Mb, delete: LARGE.HED and LARGE.DAT (graphics for maximum zoom) inside SC2000.EXE edit them in SMALL.HED and SMALL.DAT respectively
In some cases, if editing SC2000.EXE does not work, you can simply zero the contents of TXT, VOC, XMI and some other files
It is important that not all versions of the game allow such changes, for example, the DEMO version, which would be logical to start with (it no longer contains music, sounds and pop-up newspapers), does not allow you to just load SMALL.DAT and SMALL.HED twice in editing SC2000.EXE (what to do in this case? if you reset the name, then I / O starts to swear), while the full version of the game does not notice this substitution of LARGE for SMALL.
In my opinion, for a full-fledged patch on 2Mb of RAM, a competent approach, disassembly, etc. is required. which was no longer in my plans. Ideally, I would get a list of which bytes to change in SC2000.EXE and what else can be cut in the file to reduce the amount of RAM used.
In the php script attachment for packing, the upper part of the packing script is not used, it is for debugging when reading and parsing sc2000.dat and understanding what turns into what.
Doom is what you want (c) MAZter