Jump to content

Opening .mds files


Recommended Posts

Hello,

I'm currently experimenting with making German tank crews wear parkas in the winter. A problem I've run into is that they don't have headsets anymore when they wear said parkas.

I can open .mdr files to edit weapons but I haven't found a way to open .mds files yet. In fact I'm not even sure that's possible. Can anyone give me some pointers as to how to fix that, if it actually is possible?

If anyone wants me to share what I've done, just ask.

Edited by Frenchy56
Link to comment
Share on other sites

  • 1 year later...
1 hour ago, kohlenklau said:

hey Frenchy, did you ever solve the missing headsets issue?

I have a similar issue with Soviets now in early war model M35 uniforms. No gear!

The headsets are linked to the uniform, as is the gear. Nothing much we can do against the headset issue, for the gear you need to use uniform models from the same faction for it to keep showing up.

I just chose to accept it and let them not wear headsets. The parkas look cool enough.

Edited by Frenchy56
Link to comment
Share on other sites

.mds files are Battlefront properietary files for the 3d human models in the CM games. So they are similar to the .mds. files and to open them would require to "decode" their file structure and make an import script for Blender or some other 3D program, where they could be opened. Something like this that was made for the .mds files: 

 

Link to comment
Share on other sites

3 minutes ago, SchnelleMeyer said:

.mds files are Battlefront properietary files for the 3d human models in the CM games. So they are similar to the .mds. files and to open them would require to "decode" their file structure and make an import script for Blender or some other 3D program, where they could be opened. Something like this that was made for the .mds files: 

 

I guess this code must be also linked with Python progrm cos to open mdr files, a Python code had be created...?  just asking !

Link to comment
Share on other sites

Just now, SchnelleMeyer said:

Yes, but Python knowledge is not enough. - the decoding of the .mds format would be the most challenging. Writing the script in Python would be simple enough (for a programmer) when the format is known.

Good to know,.. I don t know why but peoples with a name  Meyer or Mayer...are always clever !

Link to comment
Share on other sites

  • 4 months later...

Bonjour Mr. Frenchy!

I figure this is a good thread to discuss what mds file shenanigans I have done...

In CMRT I am trying to make the early War look for the Red Army troops. This is the M35 uniform with a regular collar. A closed buttoned collar look is what I want. So I borrowed the German smock mds and renamed it as the M43 Soviet Gymanstikoya M43 uniform (mandarin collar with shoulderboards). 

I will use the terms shell and host. The "shell" mds title is the normal CMRT Soviet M43 uniform filename modded in GiMP to look like the older M35. It rides on the outside of the "host" of the German smock mds. The game engine only sees the host. The desire is for the player to of course see the modded shell. The file in the z folder says shell's title but inside is the host's hex data. Got it?

So, then you open the mds file in hexedit program and you look for the gear section of the file. I think it references like 15 or so gear items. All German of course. You can edit and rename these to the Soviet gear if you have a like number of characters. Some of them were right on the money. G-E-R-M-A-N is same as S-O-V-I-E-T. 6 letters each! 

german_radio = soviet_radio and the game engine knows who your radio operators are and plops a radio on the guys back. Similar to SMG armed guys get SMG ammo pouches, officers get "officery" stuff. It needs some position tweaking in Blender.

Sometimes you are stuck. The number of letters does not match. So nothing shows.

Then you go to Blender and you can make gear item A also have gear item B in its mdr file. Trial and error for proper body positioning in the game. 

In CMFI I just did the something similar with Free French at Bir Hakeim. The French nromally wear the US M41 uniforms and I put them in the British shorts. In progress but going well. american and british are not lucky perfect matches like I had in CMRT. In your host mds file you have to do a gear analysis of the number of letters as well as the target gear you WANT to see displayed.

28british_ammo-universal-right
27british_ammo-universal-left
24american_shovel-t-handle
23british_holster-officer
22american_shovel-e-tool
22american_pouch-compass
21british_pouch-compass
21american_ammo-carbine
20american_pouch-binoc
19british_pouch-binoc
19british_ammo-pistol
19american_ammo-rifle
18american_pouch_map
18american_pouch-aid
17american_ammo-smg
17american_ammo-lmg
17american_backpack
16british_backpack
16british_breadbag
16american_bayonet
16american_holster
16american_canteen
15british_holster
15british_canteen
15british_bayonet
15british_gasmask
14british_shovel
14american_knife
14american_radio
13british-radio

british_breadbag is in as american_bayonet
Now used Blender to add in both univ's.
Some soldiers are skipped for no breadbag.
Add canteen also later.

british_radio renamed as mdr for american_radio as british_shovel (only for radio operators). But needs position tweaked in Blender.

american_ammo-smg replaces british_canteen ***with a plan*** to paste over the shovels location data. add both univs later.
 

Of course you keep yourself sane by saving often and using a modtag for all these shenanigans.

Like the French Adrian helmet of the North African French Soldiers was mdr swapped for the kepi and then color changed to white.  modtagged! and the chin strap was alpha layered so it doesn't show. modtagged!

************

Both of the above mds shenanigan projects are in progress. PM me with any questions or offers to get involved and do cool stuff together.

 

Edited by kohlenklau
Link to comment
Share on other sites

A new report. I was able to successfully do something with the location text portion for a gear item in the mds file. Now for me, this is all foreign territory. I remember taking a college course to convert hex to decimal. I remember zilch. 

I opened the mds in HxD and copied the location portion of the gasmask gear entry. I have done some Soviet-era reverse engineering to find the similarity in the gear entry sections. I spotted the consistency in one section and what changed by the 3D location on the soldiers body. I think bip is "body insertion point" and spine 1 and spine 2 are different areas preset to be where the node of the gear mdr gets attached.

So, I just dragged and copied that part to the clipboard and then found the radio gear entry and dragged the same area AND PASTED OVER. Oh, I forgot to say I had done a lot of file analysis on this one and those 2 gear items HAPPENED to have gear entry text both with 74 characters. I took a set of 74 characters and pasted it over another different set of location info but ALSO 74 characters in length.

I fired up my test scenario with my z folder guinea pig mds file and radio went to the hip.

BINGO!

Edited by kohlenklau
Link to comment
Share on other sites

Another successful test inside the mds file.

Each gear item has a hexadecimal checksum in front of it. You can swap around gear as long as your net change in mds file length is zero.

I brought IN american canteen for british canteen 16 for a 15, that is +1

but balanced that with swapping OUT british ammo pistol 19 for american pouch map 18 , that is -1

so net zero change to file length and it worked.

The canteen is a big deal because that is "issued" to all your ground troops. (I am not discussing crews for vehicles.)

I can use Blender to put the universal ammo pouches to the canteen mdr and everybody looks good for having gear.

The officer map pouch I can blender add the compass pouch and whatever else, holster, pistol ammo pouch. I guess.

 

 

Link to comment
Share on other sites

  • 3 months later...

I figured I would use this thread to document this aspect of modding uniforms in CM.

I am working with another modder to jazz up the Italian uniforms for Afrika scenarios. He is awesome with the textures. pitbull is aka @boygarvin

Anyway, we used the German M43 with jackboots renamed as Italian M38 and this sets up what pitbull wants as the base for his new texture bmp's for an Italian sahariana jacket but causes issues with gear going poof disappeared.

These are my thoughts right now 11/30/2021.

A. Each title's game engine code or code knows what items the nation's specific soldier types get. It has a specific file list of the gear names and the soldier types who are dealt the cards for display. this would be radio's for the radioman. holsters for officers. LMG kit for the LMG gunner. canteens for almost every regular grunt. bandolier for truck drivers only it seems. ammo pouch at the belt buckle for italian riflemen. SMG ammo pouch for SMG gunners. bayonet/shovel cluster for most riflemen. It uses the mds uniform file to know where to position them on the 3D soldier body. If the mds uniform file does not list one of the gear filenames, the game code does not deal out that item for display in the game. This is why we usually saw NO GEAR AT ALL when we messed with swapping uniforms from one nation to another.

But now I have learned to do a "gear analysis" of the mds uniform files between nations and see what matches by gear filename length. I only know enough to do small tasks and maybe my lack of deeper knowledge heads me down the wrong path. I NOW am cautious to NEVER change the LENGTH of the mds uniform file. I assume it has a "checksum" and if this is altered, the game chokes up and crashes. I do not know of a way to modify the checksum so it does NOT cause the game to crash. So I look for these filenames that are the same length in characters. The double asterisks are "avenues in" where I have a chance to get my foot in the door.

italian_cluster-bayonet-shovel-together39
german_cluster-bayonet-shovel-adjacent38
german_cluster-bayonet-shovel-together38
german_cluster-bayonet-shovel-adjacent38
** italian_cluster-knife-shovel-together37
** german_cluster-breadbag-canteen-right37
german_cluster-breadbag-canteen-left36
german_cluster-breadbag-canteen-only36
german_cluster-bayonet-only27
german_gasmask-horizontal25
german horizontal poncho24
german_ammo-rifle-right23
german_gasmask-diagonal23
** italian-ammo_bandolier22
** german_ammo-rifle-left22
german_ammo-smg-right21
german_ammo-smg-left20
italian_gasmask-m33  19
italian_gasmask-m35  19
italian_ammo-rifle18
italian_breadbag16
italian_ammo-smg16
** italian_pouch-mg16
** german_pouch-map16
italian_holster15
** italian_canteen15
** german_pouch-mg15
italian_bayonet15
** italian_shovel14
** german_holster14
italian_knife13
italian_radio13
german_radio12
 

In the mds, I focus on these "avenues in" and can copy and paste using HxD program to get the German uniform mds file being used for a modded Italian uniform to show some gear. 

THEN I use Blender to double or triple up gear with that "avenue in" mdr. It takes tweaking in x y and z to TRY to get it right.

5YofwpK.pngqLmlXQh.png

So, just some remarks here to show others what I do and see if someone will scream out a better way.

I have done this same process with Soviets wearing a German mds. Also the French wearing British shorts. 

AMF

Edited by kohlenklau
Link to comment
Share on other sites

Just on the subject of text strings in mdr files, they are preceded by a byte indicating string length in characters. This may not be true for mds files, but certainly in mdr, a texture name or model object like say hetzer-hull (11 characters long) will be preceded by 0B or 0xB. I can’t remember off hand but pretty sure there is also a spacer byte 00. These can be altered to give custom string lengths without any issues, the mdr has no checksum by the looks of things and changing string lengths is fine if you also change this byte counting the length.

Link to comment
Share on other sites

5 hours ago, Jace11 said:

This may not be true for mds files

Thanks for the info and report on mdr files. The mds is where I am working. I appreciate the tips and maybe my brain can collate what you just told me and make some new type of progress with manipulation of the mds. I appreciate working with people that are smarterer than I is! Can I please pm you and maybe ask a few questions some time? 

Link to comment
Share on other sites

4 hours ago, kohlenklau said:

Thanks for the info and report on mdr files. The mds is where I am working. I appreciate the tips and maybe my brain can collate what you just told me and make some new type of progress with manipulation of the mds. I appreciate working with people that are smarterer than I is! Can I please pm you and maybe ask a few questions some time? 

 

Had a look in mds files and the same principle applies. See how all the strings are preceded by a byte indicating string length and then a 00 spacer. Then the string follows. Even the bip entries do the same:

bip01 spine is 11 characters long 11 in hexadecimal is 0B.

american_ammo-smg is 17 characters long, which is 11 in hex.

0YRFEEB.jpg

My guess is you could rename these to new model names or whatever and it would be fine as long as you also edit the size of the string in the relevant byte.

I use this technique for a few things, mostly swapping textures. For example in an mdr, I edit spare wheel names on a vehicle like the opel blitz. I rename the spare wheel texture it so it uses a different texture to the main wheels, that way I can have snowy wheels on the ground, but the spare type isn't covered in snow.

In my experience with mdr's there is no checksum. But changing a text string to a different length without telling the game its length has changed will result in a hard crash.

Edited by Jace11
Link to comment
Share on other sites

11 hours ago, Jace11 said:

I use this technique for a few things, mostly swapping textures. For example in an mdr, I edit spare wheel names on a vehicle like the opel blitz. I rename the spare wheel texture it so it uses a different texture to the main wheels, that way I can have snowy wheels on the ground, but the spare type isn't covered in snow.

Trying to follow along, hex editing is a complete mystery to me, but then so was Blender a couple of years back ...

What you are saying here Jace is very interesting and sounds like it could offer some useful workarounds.

Out of interest have you tried the same in Blender, that is adding a custom bmp texture to a vehicle to achieve something similar, and if you have does the change show up in the hex strings in the same way as editing the hex directly?

I'm wondering what else could be changed in mdrs that might be useful - perhaps changing use of bmps with 1-bit alpha channels to allow use of bmps with 8-bit alpha channels - my guess is this is controlled somewhere else but it would be interesting to know if it's assigned on a per model basis within the model file.

Thanks for taking the time to explain this technique and your findings. I'm sure Phil will absorb this into his already outstanding work on the mds files.

Link to comment
Share on other sites

Just started with blender myself and don't know what I'm really doing yet. Plus I have a feeling the import / export process loses stuff (even when importing and exporting with metadata), how important that stuff is I don't know. It seems ok with simple objects, weapons, gear, but vehicles often have janky animations or errors after exporting, but that may just be me doing stuff wrong.

I couldn't really think of many applications of redirecting the mdr models to new textures, only a couple, but there are probably more. Someone will come up with some ideas. I didn't even think to look at skeletons mds. Phil already had it figured out, this info might help him rename and organize his stuff more easily now. I don't quite know the limits of blender and the mdr tools yet so I can't say. I can say hex editing sucks, often its like looking for a needle in a haystack, but it can really open doors when you figure how a file works 😉.

The 1 bit 8 bit alpha thing might conceivably be there actually, if I were looking for it I'd have to start with two good examples of texture on models where 1 is a 1 bit alpha and the other 8 bit. The simpler the models the better I guess. Low LOD trees perhaps for a 1 bit?

I think the guy who wrote the importer tools must have figured out most of the file format? It's a shame he didn't continue to work on it, but it still helps a great deal.

Edited by Jace11
Link to comment
Share on other sites

20 hours ago, Jace11 said:

don't know what I'm really doing yet

... yup that's Blender ...

20 hours ago, Jace11 said:

Plus I have a feeling the import / export process loses stuff (even when importing and exporting with metadata), how important that stuff is I don't know. It seems ok with simple objects, weapons, gear, but vehicles often have janky animations or errors after exporting, but that may just be me doing stuff wrong.

Yes I do wonder about this. I've had success exporting models with and without the metadata, and there don't seem to be any hard and fast rules as to what will work. Vehicles are probably the most complex and frustrating, but can be made to work. I do seem to recall that @sbobovyc who developed the CM Tools import/export Blender add on was looking into what the metadata actually did, but I don't know what became of that.

20 hours ago, Jace11 said:

I can say hex editing sucks, often its like looking for a needle in a haystack, but it can really open doors when you figure how a file works 😉.

I had a look at a few files in online hex editors but don't have a clue as to what I'm looking at. I could see file names and sometimes other info related to colour etc but making sense of it was just too much for this addled brain 

21 hours ago, Jace11 said:

The 1 bit 8 bit alpha thing might conceivably be there actually, if I were looking for it I'd have to start with two good examples of texture on models where 1 is a 1 bit alpha and the other 8 bit. The simpler the models the better I guess. Low LOD trees perhaps for a 1 bit?

The easiest I can think of, and perhaps useful because they are quite similar but distinctly different, are the leaf textures for trees (8-bit alpha channels) and the leaf textures for boccage (1-bit alpha). The LODs for trees are all 8-bit I seem to recall, maybe the smallest has a 1-bit mask, can't recall off the top of my head. 

21 hours ago, Jace11 said:

I think the guy who wrote the importer tools must have figured out most of the file format? It's a shame he didn't continue to work on it, but it still helps a great deal.

He did us a great favour; really do hope one day that he, or even someone else, can figure out how to access the mds files in Blender or whatever.

Thanks again for your insights Jace.

Link to comment
Share on other sites

@Jace11 This morning I have budgeted some time to try and finish "gear blender mods" for the new Italian uniforms by pitbull. I will send you a pm and no hurry but maybe you can please assist me at your convenience in trying to use your guidance? I have a website to translate hex so I will try and be self sufficient but really appreciate your eyes looking over my shoulder! Thanks in advance...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...