ModId - Modkeen for all the 16-bit Id games!

Here is where to post about the latest Commander Keen fangame or modification you've finished, a new website you've made, or another Keen-related creation.
User avatar
lemm
Blorb
Posts: 682
Joined: Fri Jul 03, 2009 10:18
Location: canada lol

ModId - Modkeen for all the 16-bit Id games!

Post by lemm » Mon Mar 14, 2016 22:19

Hi folks,

Over the last couple of weeks, NY00123 and I have worked to improve LModkeen 2 so that it supports import and export for arbitrarily formatted graphics archives. This tool was originally hacked together for Atroxian Realm and the CK Source Mod, but I decided that it would be a good idea to fix it up so that everyone else would be able to use it.

From the readme:
ModId is a tool for modifying games that were created with the 16-bit DOS engines that Id Software developed in the early 1990s. ModId is a command-line utility that will export graphics from these games into BMP files, and import those BMPs back into the graphics archives used by these games. Such games include Commander Keen, Bio Menace, Catacomb 3-D, Rescue Rover, Wolfenstein 3D (VGAGRAPH only), Dangerous Dave, and possibly others.
It also uses 256-color bitmaps with a whole host of options, including the ability to import and export both CGA and VGA graphics archives. If you want to do CGA Keen or Wolf modding, this tool is for you!

Like LModkeen, ModId can be built for both Windows and Linux. With the source, I've provided a win32 build.

Download: ModId v 0.1 - Github


Enjoy!

User avatar
szemi
Vorticon Elite
Posts: 1563
Joined: Sun Jan 11, 2009 15:19
Location: Hungary
Contact:

Post by szemi » Tue Mar 15, 2016 20:37

And what if I want to modificate Catacombs 3D that I built up in Borland? Because Modid complains about the offset of the built Catacombs 3D's EXE file.
Yeah, piece of cake!

User avatar
szemi
Vorticon Elite
Posts: 1563
Joined: Sun Jan 11, 2009 15:19
Location: Hungary
Contact:

Post by szemi » Tue Mar 15, 2016 20:38

And what if I want to modificate Catacombs 3D that I built up in Borland? Because Modid complains about the offset of the built Catacombs 3D's EXE file, which isn't even packed with LZEXE or any other compressing programmes.


(PS. I accidentally doubled my post.)
Yeah, piece of cake!

User avatar
Nisaba
Vorticon Elite
Posts: 772
Joined: Fri Jan 01, 2016 23:34
Location: The Outpost
Contact:

Post by Nisaba » Tue Mar 15, 2016 20:56

sweet cake!
I'm going to check on that. and I'm really happy that ModId is also Linux compatible! this might make things easier for me. thanx though!
Last edited by Nisaba on Tue Mar 15, 2016 23:05, edited 1 time in total.
"We have come to conquer you all and bring you lots of candy!" | about me | my current project: play Keen mods on a GameBoy |

NY00123
Vorticon Elite
Posts: 440
Joined: Sun Sep 06, 2009 19:36

Post by NY00123 » Tue Mar 15, 2016 22:18

Hey there,

For some weird reason I had an interest in having some tool that lets ones mess with CGA graphics, so here we are. I've also done a few more things, like going over some .def files.

Note that there's currently a known bug with exporting fonts from VGAGRAPH. This can be observed while exporting the first font from Super 3-D Noah's Ark, as mentions of color no. 31 are replaced with 15. In practice, though, I think that the actual color itself doesn't change in a noticeable way.

I must say, though, that supporting the .def files as done now is *really* useful. It could assist me with the Keen Dreams Tech Demo earlier (more than a year ago by now), and can surely help right now. While the definitions for specific known game versions won't change, the .def files can greatly assist when one wants to modify such definitions, or even create new ones from scratch.

Thanks to any preceding contributor to the codebase, and others, for their support!
szemi wrote:And what if I want to modificate Catacombs 3D that I built up in Borland? Because Modid complains about the offset of the built Catacombs 3D's EXE file, which isn't even packed with LZEXE or any other compressing programmes.
The point about LZEXE is a bit weird, since I'm quite sure it is packed. This at least the case with version 1.22 as available from GOG.com and supported with the given .def, but v1.00 may also work after creating a modified .def file with somewhat different details for the EXE.

ModId expects to have the unpacked EXE ready for internally reading the EGAHEAD.C3D and EGADICT.C3D chunks while exporting the data. During importing, the EXE is further required for the EGADICT.C3D data. Three new files should be found after importing: EGAGRAPH.C3D, EGAHEAD.C3D and EGADICT.C3D.

There is theoretically more than one way to make these usable (option 2 is the most straightforward):

1. Update CKxPATCH to also include a C3DPATCH, and use that.

2. Using the Catacomb 3-D sources (which are for v1.22, but may also be compatible with 1.00), build an EXE that reads all EGA data from external files, without linking EGAHEAD.C3D or EGADICT.C3D into the EXE. That should be possible by commenting out the definition of GRHEADERLINKED.

3. Link EGAHEAD.C3D and EGADICT.C3D into the EXE. This means they should be converted to OBJ files that Borland C++ can use. The released Keen Dreams sources include a copy of makeobj.c from Braden Obrzut, which should be built using Borland's bcc and may create the OBJs. See here for an example: https://github.com/keendreams/keen/blob ... c/make.bat

These should be the lines for all kinds of data that may be embedded in cat3d.exe:

Code: Select all

makeobj f introscn.scn ..\introscn.obj IntroscnSeg _introscn
makeobj c audiodct.c3d ..\c3dadict.obj _audiodict
makeobj f audiohhd.c3d ..\c3dahead.obj _AudioHeader _audiohead
makeobj c egadict.c3d ..\c3dedict.obj _EGAdict
makeobj f egahead.c3d ..\c3dehead.obj EGA_grafixheader _EGAhead
makeobj f mtemp.tmp ..\c3dmhead.obj MapHeader _maphead
POST EDIT: Looks like these were missed for some reason.

A few side-notes:

1. When exporting graphics, if matching xGAHEAD and xGADICT files are found alongside the xGAGRAPH, there should be no need for the game's EXE. This is the case, for instance, with the various Wolfenstein 3D releases.

2. makeobj has a way to extract the contents of an obj, like this:

Code: Select all

makeobj x somefile.obj
Last edited by NY00123 on Tue Mar 15, 2016 22:39, edited 3 times in total.

User avatar
szemi
Vorticon Elite
Posts: 1563
Joined: Sun Jan 11, 2009 15:19
Location: Hungary
Contact:

Post by szemi » Tue Mar 15, 2016 22:28

For option 2: How do you mean build an EXE without linking the EGADICT and EGAHEAD.C3D? How can I do that?
Yeah, piece of cake!

NY00123
Vorticon Elite
Posts: 440
Joined: Sun Sep 06, 2009 19:36

Post by NY00123 » Tue Mar 15, 2016 22:33

szemi wrote:For option 2: How do you mean build an EXE without linking the EGADICT and EGAHEAD.C3D? How can I do that?
Wow, that's been quick for a reply from you!

Have you read all text in option 2? You should see how to do it.

User avatar
szemi
Vorticon Elite
Posts: 1563
Joined: Sun Jan 11, 2009 15:19
Location: Hungary
Contact:

Post by szemi » Tue Mar 15, 2016 22:49

I read it, but I think I failed it.

I built the EXE, then I linked all the files except EGAHEAD and EGADICT.C3D.


I guess it's wrong.
Yeah, piece of cake!

User avatar
Roobar
Vorticon Elite
Posts: 2749
Joined: Tue Jan 08, 2008 16:12

Post by Roobar » Wed Mar 16, 2016 5:30

Being no expert in this, does this tool allow to make a VGA Keen?

User avatar
Levellass
S-Triazine
Posts: 5261
Joined: Tue Sep 23, 2008 6:40

Post by Levellass » Wed Mar 16, 2016 9:27

Sadly no. But it could edit a VGA Keen if you had one!
What you really need, not what you think you ought to want.

User avatar
szemi
Vorticon Elite
Posts: 1563
Joined: Sun Jan 11, 2009 15:19
Location: Hungary
Contact:

Post by szemi » Wed Mar 16, 2016 13:56

@NY00123: I used CMD.EXE instead of DOSBox.

Moreover, I'm using Borland 2.0 now (as I used 3.1 before). I understand what you said, absolutely followed the second option. But:

As for static/make.bat, it doesn't work for me (in CMD.EXE). I used the parameters you have written down for Catacombs 3d files, but doesn't work.

Now I don't know what to do, I'm sure I did everything right (in my opinion the rest of the steps). All that's problematic is the offset of the built EXE file. Because of this, modid cannot extract the graphics normally as it only extracts the fonts, which are kinda corrupted, because these are blank bmp files. Then modid stops.


Minor thing: I exported the graphics from the original game, then I imported back everything into that, then modid created a cat3d.pat. But how can I use that if no C3DPATCH.EXE? I cannot even know Turbo Pascal very good to build the patching tool.

So somehow I want further help from you, NY00123 (and from lemm, too.)
Yeah, piece of cake!

NY00123
Vorticon Elite
Posts: 440
Joined: Sun Sep 06, 2009 19:36

Post by NY00123 » Wed Mar 16, 2016 20:44

Hey szemi,

Before replying to specific queries of yours, I've forgotten there's something the project file probably shouldn't have:
- You may have to remove C3DEHEAD.OBJ and C3DEDICT.OBJ from the list of files in the Borland C++ project, if you go for disabling the linking of these EGA-related resources.
- If you haven't found it, ID_CA.H has the definition of GRHEADERLINKED that should be commented out for the above.
- Afterwards, it may be safer to clean the project, which means removing any generated EXE or OBJ file. You should still keep any required resource file like C3DADICT.OBJ, though.
szemi wrote:@NY00123: I used CMD.EXE instead of DOSBox.
Did you use DOSBox beforehand? If yes, then depending on the mounts in use, You may need to adjust some paths (like the PATH environment variable and the include+lib directories in the Borland C++ project).
Moreover, I'm using Borland 2.0 now (as I used 3.1 before).
Just to reduce possible troubles, you may have to clean the project as described above. Borland C++ 2.0 and 3.1 are both known to be able to build working CAT3D.EXE files, though.
As for static/make.bat, it doesn't work for me (in CMD.EXE). I used the parameters you have written down for Catacombs 3d files, but doesn't work.
Make sure Borland C++ is properly set-up, including the PATH environment variable, so BCC.EXE can be found. This is used for building makeobj.c. Afterwards, you may wish to adjust the parameters. In the make.bat file from the Keen Dreams sources, the objects are created in the source directory itself, rather than the "static" dir.
Now I don't know what to do, I'm sure I did everything right (in my opinion the rest of the steps). All that's problematic is the offset of the built EXE file. Because of this, modid cannot extract the graphics normally as it only extracts the fonts, which are kinda corrupted, because these are blank bmp files. Then modid stops.
Are you sure you have version 1.22 of Catacomb 3-D (as currently available from GOG.com)? For any other version, you'll have to create a new .def file for ModId, although I suspect that only the "EXEINFO" values have to change in the case of Catacomb 3-D.

Once that's done, ModId should work with just CAT3D.EXE and EGAGRAPH.C3D.

Alternatively, you can use makeobj to extract EGAHEAD.C3D and EGADICT.C3D from C3DEHEAD.OBJ and C3DEDICT.OBJ, respectively. I simply know these are the same as in v1.22. You can then tell ModId to use these with EGAGRAPH.C3D for exporting all contents. Obviously these three EGA files have to reside in the same directory, which you pass to ModId as a parameter (with -gamedir).
Minor thing: I exported the graphics from the original game, then I imported back everything into that, then modid created a cat3d.pat. But how can I use that if no C3DPATCH.EXE? I cannot even know Turbo Pascal very good to build the patching tool.

So somehow I want further help from you, NY00123 (and from lemm, too.)
Yeah, it's basically another game lacking support in CKxPATCH. I don't think the motivation for adding that is great at this point, though, given the availability of the sources.

User avatar
szemi
Vorticon Elite
Posts: 1563
Joined: Sun Jan 11, 2009 15:19
Location: Hungary
Contact:

Post by szemi » Wed Mar 16, 2016 21:04

When I built up my EXE, I checked it with a hex editor and the starting screen said version 1.22 rev 1.
Yeah, piece of cake!

NY00123
Vorticon Elite
Posts: 440
Joined: Sun Sep 06, 2009 19:36

Post by NY00123 » Wed Mar 16, 2016 21:09

szemi wrote:When I built up my EXE, I checked it with a hex editor and the starting screen said version 1.22 rev 1.
Of course that's the case, since the sources are for this version, heh. C3_MAIN.C should have a few mentions of "1.22".

Question is, is the original game data (and EXE not built from the sources) from the same version? I know that version 1.00 shows a textual intro screen on launch, as done in Keen 4-6 (Cat3D v1.22 doesn't). Version 1.00 is then mentioned on the top of the screen.

User avatar
szemi
Vorticon Elite
Posts: 1563
Joined: Sun Jan 11, 2009 15:19
Location: Hungary
Contact:

Post by szemi » Wed Mar 16, 2016 21:11

1.22 doesn't show loading Keen 4-6-like screen, but as I remember 1.00 does show that.

I checked C3_MAIN.C and there I see 1.22 rev 1.
Yeah, piece of cake!

Post Reply