Hard Light Productions Forums

Hosted Projects - Non-FreeSpace => MechCommander OmniTech => Topic started by: Autohummer on March 30, 2016, 01:43:15 pm

Title: Adding a Mechwarrior
Post by: Autohummer on March 30, 2016, 01:43:15 pm
While there is a guide on adding mechs, warrior brains and modifying purchase files, I cannot seem to find a guide on adding a new Mechwarrior to MCO. I have dug around the MCO files a bit but could not figure out how new Mechwarriors (such as those from MC1) were added. Much thanks for an answer.
Title: Re: Adding a Mechwarrior
Post by: Karl on March 30, 2016, 05:07:27 pm
Hi Autohummer,

I think it can be done easily with the new abl codes of recent releases.

I will have a crack and report back if you would like?
Title: Re: Adding a Mechwarrior
Post by: Autohummer on March 31, 2016, 12:06:12 am
I have looked a bit at the abl library (this is new to me) and the following concerns pilots:

Code: [Select]
25.
New ABL command - hirepilot(pilotFileName)
Effect: Add pilot to players roster; Example: hirepilot("pmwlynx");

26.
addnewpilot(MechID, "pilotFileName", "brainFileName");
MechID - part id for mover (getunitmates(squadID)) from squad ID.
pilotFileName - name of the pilot file (pmwlynx).
brainFileName - name of the brain file (pbrain, dredattack01,...)

Effect: Create new pilot from file and add to selected mech. It also sets the brain file.
If the pilot exists it will overwrite the pilot. DO NOT add pilots that are used in SP campaign before, it will erase
all accumulated experience. Use only to add new pilots. If the pilot is already on players roster, pilot icon will
not change. Must use script to remove mover from player then add it back after calling this command eg.:
   addnewpilot(Commando, "pmwgator", "pbrain");
   addmovertoplayer(Commando, 0, 2); //remove commando from player roster and add to allied team
   addmovertoplayer(Commando, 0, 0); //add commando to player roster

27.
(the same as addnewpilot but can be used for players units only - sets pilot icon correctly)
addnewpilottoplayer(MechID, "pilotFileName", "brainFileName");
MechID - part id for mover (getunitmates(squadID)) from squad ID.
pilotFileName - name of the pilot file (pmwlynx).
brainFileName - name of the brain file (pbrain, dredattack01,...)

Effect: Create new pilot from file and add to selected mech. It also sets the brain file.
If the pilot exists it will overwrite the pilot. DO NOT add pilots that are used in SP campaign before, it will erase
all accumulated experience. Use only to add new pilots. Allied team must exist in mission and must have at least one unit.

These functions handles adding a pilot existing in the game files to a mech or add it to an existing campaign. What I would like to do is to create a new pilot from scratch and add it to the game.

I have looked at the pmwlynx.fit file for Lynx (IIRC the PMW files are for singleplayer and the PMP files are for multiplayer) in the data/missions/warriors folder. It is directly editable with notepad++ and I think I can use it as a base to make my own new pilot. However, there are a few parameters that I don't understand or am unsure of:

Code: [Select]
[General]
st Brain = "pbrain"
st Name =                                                  "Lynx"
l Rank =                                                    1  <--- I suppose 0=Rookie 1=Regular 2=Veteran 3=Elite 4=Ace?
st Callsign =                                              "LYNX"
ul ID =                                                     228   <--- I suppose this has to be an unique ID? How do I know what numbers have been taken?
l NameIndex =                                               29   <--- I think this links to another file somewhere but I don't know which
l DescIndex =     42028 42003   <---  Same as above, but does pilot descriptions even show up in MC2/MCO?
ul HeadIcon =                                               0  <--- Seems to be 0 no matter what
l paintScheme =                                             31  <--- Seems to be 31 no matter what, but does this imply individual pilots can be given a custom paint scheme?
st pilotAudio =                                            "Lynx"   <--- Please help: I found Lynx.pak in the data/sound folder but I have absolutely no idea how to open this file
st pilotVideo =                                            "Lynx"   <--- I found Lynx1.bik-Lynx4.bik in the data/movies folder and it seems only MCG pilots have them, MC2 pilots who does not have movies uses "PILOT29" instead
l PictureIndex = 28   <--- I think this is the portrait for the pilot. The portraits are stored in the pilots_med, pilots_L2 and pilots_high.tga files in the data/art folder and Lynx's portrait is at the 29th if counted from left to right, top to bottom, implying that the "first" portrait has a PictureIndex of 0. However, for MCG pilots, they have another MCL_PR_(callsign).TGA files that has a bigger portrait and for Lynx's case, his description.


[PersonalityTraits]    <--- These four parameters are 50 for everyone. Do they actually do anything?
c Professionalism =                                         50
c Decorum =                                                 50
c Aggressiveness =                                          50
c Courage =                                                 50

[Skills]
c Piloting =                                               50
c Sensors =                                                50
c Gunnery =                                                55
c Jumping =                                                45

[Weapons] <--- What do these parameters do? MCG pilots have them but not the MC2 ones. Are they optional?
l Balistic_miss = 98
l Balistic_hit = 98
l Energy_miss = 242
l Energy_hit = 216
l Missile_miss = 0
l Missile_hit = 0
l lightMech_specialist = 2
l mediumMech_specialist = 1
l heavyMech_specialist = 1
l assaultMech_specialist = 0

[SpecialtySkills]
c LightMechSpecialist= 0
c MediumMechSpecialist= 0
c LaserSpecialist= 0
c LightACSpecialist= 0
c MediumACSpecialist= 0
c SRMSpecialist= 0
c SmallArmsSpecialist= 0
c ReconSpecialist= 0
c ToughnessSpecialist= 0
c HevayMechSpecialist= 0
c PulseLaserSpecialist= 0
c ERLaserSpecialist= 0
c LRMSpecialist= 0
c PPCSpecialist= 0
c Scout= 0
c LongJump= 0
c AssaultMechSpecialist= 0
c GaussSpecialist= 0
c HeavyACSpecialist= 0
c ShortRangeSpecialist= 0
c MediumRangeSpecialist= 0
c LongRangeSpecialist= 0
c Deadeye= 0
c SharpShooter = 0

[Awards]
c CampaignRibbon1 = 0
c CampaignRibbon1WithHonors = 0
c CampaignRibbon2 = 0
c CampaignRibbon2WithHonors = 0
c CampaignRibbon3 = 0
c CampaignRibbon3WithHonors = 0
c PurpleHeart = 0
c Valor = 0
c UncommonValor = 0

[Affinities]     <--- These parameters are 0 for everyone. Do they actually do anything?
c MechClass =                                               0
c MechType =                                                0
c WeaponClass =                                             0
uc[2] WeaponTypes =                                        0,0

[Status]
c Wounds =                                                  0


EDIT: Found this guide for MCG, don't know how relevant it is to MCO though the file structure look mostly similar http://www.nogutsnogalaxy.net/stuff/Files/Mechcommander/CMunsta/Creating%20Warriors%20for%20MCG.pdf

P.S. The biggest problem I am facing is that I don't know how to work with those audio .pak files. My search suggests I need something called xplist.exe but the links are down.

EDIT 2: Found this tool: http://www.nogutsnogalaxy.net/stuff/Files/Tools.rar from here: http://www.nogutsnogalaxy.net/forum/index.php?topic=694.msg12054#msg12054 and managed to extract a voice .pak into 40 .tmp files that can be directly edited with audacity.

EDIT 3: I am now stuck at another problem, I have no idea what the DescIndex links to in MCO. It is stopping the pilot callsign from showing up properly and the portrait from linking properly. Game crashes when it enters pilot hiring screen, citing my made-up DescIndex number.
Title: Re: Adding a Mechwarrior
Post by: wolfman-x on March 31, 2016, 07:41:42 am
The abl commands can be used to add a pilot to a mission by script. The pilot needs to exist in the game and that means it needs to have pictures, voices, a skilltable and several declarations inside the system files and the source code. The later can not be done by abl commands.
Title: Re: Adding a Mechwarrior
Post by: Autohummer on March 31, 2016, 08:57:41 am
The DescIndex links to the mc2rel.dll file in the omnitech main folder. I used a resource editor to open the .dll and fill in the necessary lines. The DescIndex can be made-up as long as it does not conflict with the numbers in the strings already present in the mc2rel.dll file. I entered my made-up DescIndex and filled out the name and the game now reads fine. Next order of business is to import the voice files and portrait I have already prepared beforehand.

EDIT: Mostly got it to work except the audio which I save for tomorrow. I would like to know if there is a set format for the audio files.
Title: Re: Adding a Mechwarrior
Post by: Karl on April 02, 2016, 02:21:30 pm
How did you get on Autohummer? (Seems like you didnt need much help)

Possibly message ThorC, he helped magic with all the MC1 pilots
Title: Re: Adding a Mechwarrior
Post by: magic on April 02, 2016, 04:18:24 pm
I would like to know if there is a set format for the audio files.

Open one of the extracted files in any audio editor and you can see audio format.
After you make your own audio files pack them with the same tool in correct order and name it myPilot.pak.
Then open pmwMyPilot and add your pilot sound file name to the end of the correct line, replacing any other file name...
Title: Re: Adding a Mechwarrior
Post by: Autohummer on April 03, 2016, 12:23:02 pm
Thanks for the help, everyone. I am still holding up on the audio side since the voices I have prepared beforehand don't seem to conform to the MC2 radio procedures very well, requiring some creative fiddling that I have yet to complete. I am using a placeholder for now and the rest worked out fine. I will report back once I have begun audio file importation. One thing that I would like to know is what situation each number of the 1-40 sequence refers to. So far I am figuring it out by listening to it, but is there a list somewhere that simply says voice# is for what situation? Also. I am getting .tmp files when I extract the .pak files, I can only trust Audacity knows what it is doing when I overwrite each file with my own audio and save it directly.

EDIT: I think I am in need of a pak-packer. The tool I have doesn't want to pack .pak files, only extract them.
Title: Re: Adding a Mechwarrior
Post by: Karl on April 03, 2016, 04:57:36 pm
Re the pak creator, possibly check a MCG tool set?

Not confident on that but a suggestion
Title: Re: Adding a Mechwarrior
Post by: Autohummer on April 04, 2016, 04:03:37 am
I have found a pakmake.c from https://github.com/oseparovic/MCGExtract but I know nothing about compiling code. Apart from it I cannot find any kind of pak packing tool. It would be great if someone could put up a link for the pak packer they use on here.
Title: Re: Adding a Mechwarrior
Post by: Autohummer on April 11, 2016, 04:54:53 am
Double posting here, I am still having trouble looking for a pak maker for MC2/MCG. Is there any alternative to make the game read files that are not put in a pak? Thanks in advance for any help.
Title: Re: Adding a Mechwarrior
Post by: magic on April 29, 2016, 04:22:49 am
Hey Autohummer,

any progress?
Title: Re: Adding a Mechwarrior
Post by: Autohummer on March 25, 2017, 02:06:50 pm
Sorry for the long leave, RL can be bad sometimes. I've just gotten the wavs packed and the 1st mission of Carver V starts normally, but then I got this error when I start moving my mechs, I suspect it's an issue with the format of the audio files. I made sure that I exported my wavs with Audacity in signed 16 bit, mono, 22050Hz (no idea how to set the bps) but still no luck. Any ideas?

This is the error I got:
Code: [Select]
STOP      : FAILED (0x80070057 - WINERR_The parameter is incorrect. ) - CreateSoundBuffer(0x2351730: DSBCAPS_CTRL3D | DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_LOCSOFTWARE , (PCM 16-bit, 1 Channel, 22050Hz, 44100bps))


STOP      : FAILED (0x80070057 - WINERR_The parameter is incorrect. ) - CreateSoundBuffer(0x2351730: DSBCAPS_CTRL3D | DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_LOCSOFTWARE , (PCM 16-bit, 1 Channel, 22050Hz, 44100bps))

Processor Registers EAX=0x00000000 EBX=0x00000000 ECX=0x00000000 EDX=0x00000000 Flags=0x00000000
=================== ESI=0x00000000 EDI=0x00000000 EBP=0x0018E3A8 ESP=0x0018DE58   EIP=0x00000000
EIP (0x00000000) ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
ESP (0x0018DE58) 0018DE98 80070057 02351730 046EDCF8 00000014 FFFFFFFE 76F500F8 76F4FDAF
                 00000001 0018E3B8 00000200 00000103 2C3D6008 00000100 000000F7 336F40E8
                 00010000 000002FA 30B9F008 4971AE44 00000000 0650B660 00000002 00000000

Machine details
===============
Executable name           : C:\Program Files (x86)\MechCommanderOmnitech\MCORel.exe
Executable time, date     : 20:12:30 Friday 10/30/2015
Command line              :
Current directory         : C:\Program Files (x86)\MechCommanderOmnitech
Current time, date        : 02:38:08 Sunday 3/26/2017
GameOS build version      : Version 1.1 11/2/2000
Software rasterizer       : c:\program files (x86)\mechcommanderomnitech\assets\binaries\blade.dll (Size 286,786 bytes)

I can force the game to continue, but it would crash with the following error:

Code: [Select]
EXCEPTION : Attempt to read from NULL in MCOREL! (+0x1FEF58)


EXCEPTION : Attempt to read from NULL in MCOREL! (+0x1FEF58)
Address   : 0x005FFF58
Location  : MCOREL! (+0x1FEF58)

Call Stack
==========
0x123C3B78                                 

Processor Registers EAX=0x00000000 EBX=0x00000000 ECX=0x0018E59C EDX=0x0018E594 Flags=0x00210202
=================== ESI=0x046EDC30 EDI=0x00000000 EBP=0x0018E598 ESP=0x0018E548   EIP=0x005FFF58
EIP (0x005FFF58) 8B 07 53 55 51 8B 4C 24 2C 52 8B 54 24 2C 51 8B 4C 24 2C 52 8B 50 2C 51 57 FF D2 8B F0 85 F6 7D
ESP (0x0018E548) 046EDCF8 046EDC30 046EDC88 00000000 005D1763 00000000 00000000 00000000
                 0018E5A4 0018E594 0018E59C 0018E598 00000000 0018E680 046EDC30 046EDC44
                 00000000 00000001 123C3B70 0018E5AC 00000000 123C3B78 00000000 00000000
ESI (0x046EDC30) 01 00 00 00 00 00 00 00 3A BF 16 1D 3A BF 16 1D 00 00 00 00 00 00 00 00 FF FF FF FF 00 00 00 00
                 A0 3C FD 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF 01 FF FF FF FF FF FF FF
ECX (0x0018E59C) 78 3B 3C 12 00 00 00 00 00 00 00 00 70 3B 3C 12 C0 E5 18 00 AD 14 47 76 00 00 35 02 00 00 00 00
EDX (0x0018E594) AC E5 18 00 00 00 00 00 78 3B 3C 12 00 00 00 00 00 00 00 00 70 3B 3C 12 C0 E5 18 00 AD 14 47 76

Machine details
===============
Executable name           : C:\Program Files (x86)\MechCommanderOmnitech\MCORel.exe
Executable time, date     : 20:12:30 Friday 10/30/2015
Command line              :
Current directory         : C:\Program Files (x86)\MechCommanderOmnitech
Current time, date        : 02:38:47 Sunday 3/26/2017
GameOS build version      : Version 1.1 11/2/2000
Software rasterizer       : c:\program files (x86)\mechcommanderomnitech\assets\binaries\blade.dll (Size 286,786 bytes)
Title: Re: Adding a Mechwarrior
Post by: magic on March 26, 2017, 05:44:24 am
Do you have any NULL sound packets in your pak file. You could have missed the spot.

Dont skip any (even if they are null in the originals) sound. 
Try this:

http://omnitech.hard-light.net/team/magic/Sounds/Pilot_transfer_from_MCG.rar

There is .BAT file prepared for making sound.pak.
Title: Re: Adding a Mechwarrior
Post by: Autohummer on March 26, 2017, 05:46:39 am
I found out the hard and time-consuming way that one should never use completely empty sound files as a blank placeholder. Even a second of utter silence is good, but don't export files with precisely nothing in them.

EDIT: Ninja'd.
Title: Re: Adding a Mechwarrior
Post by: magic on March 26, 2017, 05:49:42 am
Or pack your pilot files and send me...
Title: Re: Adding a Mechwarrior
Post by: Autohummer on March 26, 2017, 06:29:54 am
It's okay, I got it working now.

EDIT: I planned to add in Mechwarriors from the MW4 games but I couldn't find the voices, so I added my own OCs into the game, instead.

EDIT #2: After upgrading to the latest version of MCO, I keep getting this error when I finish a mission

Code: [Select]
EXCEPTION : Attempt to read from address 0x000000E0 in MCOREL! (+0x14C526)


EXCEPTION : Attempt to read from address 0x000000E0 in MCOREL! (+0x14C526)
Address   : 0x0054D526
Location  : MCOREL! (+0x14C526)

Call Stack
==========
0x004F25F1 MCOREL! (+0xF15F1)               
0x004EA71A MCOREL! (+0xE971A)               
0x00402D13 MCOREL! (+0x1D13)               
0x005C4F94 MCOREL! (+0x1C3F94)             

Processor Registers EAX=0x000000E0 EBX=0x000000E0 ECX=0x0C199A34 EDX=0x02020E09 Flags=0x00210202
=================== ESI=0x1AE60124 EDI=0x0C397EB0 EBP=0x0018E424 ESP=0x0018E424   EIP=0x0054D526
EIP (0x0054D526) 8B 00 83 78 08 00 75 10 8B 55 0C 33 C0 52 50 E8 26 F7 FF FF 5D C2 08 00 8B 55 0C 83 C0 0C 52 50
ESP (0x0018E424) 0018E510 004F25F1 000000E0 00000000 9CD101FF FFFFFFFF 02653D30 00000000
                 77903406 77903431 000011AE 000011B8 16F0FA38 02653D3C 0000117C 00000000
                 00000001 1292A908 00000078 00000000 12EA6C48 004AADDD 12EA6C48 00000000
EDI (0x0C397EB0) C0 7E 39 0C 00 00 00 00 54 99 19 0C 00 00 00 03 00 00 00 00 B0 7E 39 0C B0 9A 19 0C 00 00 00 00
                 00 00 00 00 00 00 00 00 98 86 FE 0F 00 00 00 00 00 00 00 00 D0 7E 39 0C 18 87 FE 0F 00 00 00 03
ESI (0x1AE60124) 24 C0 6A 00 02 00 00 00 05 00 00 00 03 08 00 00 13 00 00 00 2C 05 00 00 47 05 F5 43 B4 07 BE C3
                 A0 0C 89 43 9E 00 00 00 A1 00 00 00 85 14 00 00 37 00 30 00 00 00 00 FF 00 00 0C 42 69 3A 33 43
ECX (0x0C199A34) 90 28 E4 0D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
EDX (0x02020E09) ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??

Machine details
===============
Executable name           : C:\Program Files (x86)\MechCommanderOmnitech\MCORel.exe
Executable time, date     : 17:53:46 Tuesday 3/7/2017
Command line              :
Current directory         : C:\Program Files (x86)\MechCommanderOmnitech
Current time, date        : 22:50:11 Sunday 3/26/2017
GameOS build version      : Version 1.1 11/2/2000
Software rasterizer       : c:\program files (x86)\mechcommanderomnitech\assets\binaries\blade.dll (Size 286,786 bytes)
Title: Re: Adding a Mechwarrior
Post by: magic on March 27, 2017, 01:27:23 am
Please send me your pilot files, I would like to test...

Have you added your pilot to pilots file?
Title: Re: Adding a Mechwarrior
Post by: Autohummer on March 28, 2017, 08:03:42 am
Added the pilots to the pilots file and everything now works, thanks. Speaking of the pilot files, do you want just the fit files or the portraits/audio as well?
Title: Re: Adding a Mechwarrior
Post by: magic on March 28, 2017, 11:58:28 am
If it works, pack everything. I want to add your pilot(s) to MCO, with your permission?
Title: Re: Adding a Mechwarrior
Post by: Autohummer on March 29, 2017, 01:16:21 am
I'll be glad to help out however I can, but give me some time to fire up MW4 Mercs/MW4 Vengence and hunt down the audio files properly then put the pilots in the game. Right now I have only added two pilots to test if everything checks out, those two are my original characters with portraits drawn by my friends and audio sourced from another game so they won't fit in the MCO interface at all. (In fact I had to voice one of those two OCs myself)
Title: Re: Adding a Mechwarrior
Post by: magic on March 29, 2017, 05:18:30 am
 :yes:
Title: Re: Adding a Mechwarrior
Post by: Autohummer on March 29, 2017, 12:45:49 pm
Tracked down the audio for MW4 Mercs, I will be very busy the coming days but I'll see if I can squeeze in the time to add the new pilots.

I am kind of worried about the legal issues of porting stuff from other games into MCO. Using MW4 assets, which is from the same franchise, may be fine according to modding conventions, but my other OC uses voices I got from a totally different game (I voiced my mech-pilot alter-ego, so no problem with that).
Title: Re: Adding a Mechwarrior
Post by: Autohummer on April 04, 2017, 02:16:23 pm
Double-posing: Added MW4 Mercenaries mechwarriors except Spectre as I couldn't find enough sound bytes. MW4 Vengence mechwarriors are not added yet as I am struck by a bout of laziness. I also haven't tested the pilots. Should I put up the files anyway?
Title: Re: Adding a Mechwarrior
Post by: magic on April 05, 2017, 01:20:36 am
Yes, I can test.

How you did mw4 pilots?
There are too few sounds for transfer to MCO?
Title: Re: Adding a Mechwarrior
Post by: Autohummer on April 05, 2017, 03:36:46 am
Code: [Select]
STOP      : FAILED (0x80070057 - WINERR_The parameter is incorrect. ) - CreateSoundBuffer(0x3f1730: DSBCAPS_CTRL3D | DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_LOCSOFTWARE , (PCM 2048-bit, 1 Channel, 11025Hz, 5644bps))

Processor Registers EAX=0x00000000 EBX=0x00000000 ECX=0x00000000 EDX=0x00000000 Flags=0x00000000
=================== ESI=0x00000000 EDI=0x00000000 EBP=0x0018E3A8 ESP=0x0018DE58   EIP=0x00000000
EIP (0x00000000) ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
ESP (0x0018DE58) 0018DE98 80070057 003F1730 0BC216F8 00000014 FFFFFFFE 779300F8 7792FDAF
                 00000001 0018E3B8 00000200 00000103 2AAA4DE0 00000100 000000F7 2A65BEE0
                 00010000 000002FA 20649008 A45CCFEC 00000000 049C2050 00000002 00545522

I got this error when I start a mission with the new pilots. Something to do with the sound format, perhaps?

Fortunately, there are enough quotes per pilot in MW4 Mercs that I could fit into MCO after some creative fiddling. In theory I can try cutting Spectre's lines in the missions to make a full voice set, but that is too much for me at the moment.

EDIT: Wait, it's the same null sound error. But I think I used a non-null silent file for a0030 (no ammo) this time. Since pilots in MW4 don't inform you when they run out of ammo so I used a silent sound file which worked earlier. Alternatively I could use the Betty AI's ammunition depleted announcement instead but that would be the same for all MW4 pilots.

EDIT#2: https://www.sendspace.com/file/f6zads Here is my progress up to today, just the files I have changed/added. I don't know why the same silent (not null) sound file I used for my OCs would not work for the MW4 Mercs pilots. Also, I think I messed up trying to get the game to differentiate between pilots with the same name (there is a Claymore, Goblin, Gator, Scooter and some other pilots in MW4M that is the same as what is already in MCO)
Title: Re: Adding a Mechwarrior
Post by: magic on April 08, 2017, 07:10:06 am
Then try without them...

Please send me unpacked sound files for some of MW4 pilots.
Title: Re: Adding a Mechwarrior
Post by: Autohummer on April 08, 2017, 08:57:48 am
https://www.sendspace.com/file/g3bf7v
Here we go. The "New folder" inside each named folder contains the files I added to the .pak.
Title: Re: Adding a Mechwarrior
Post by: magic on May 31, 2017, 06:02:34 am
Just had some free time to look at your work...

Your pilot sound files are 11025Hz, 4 bit, mono (45 kbps).
MCO sound crushes on every pilot sound...
All pilot sound files should be 8 bit, mono (suggested 12000Hz, 8bit, mono (96 kbps)). All must be re-sampled and amplified.
Also your 0030 file is 352 kbps.

I changed Aisa and Angel sounds and everything works fine..
Title: Re: Adding a Mechwarrior
Post by: Autohummer on June 07, 2017, 08:42:45 am
Thanks for the tip, working on it now.
Title: Re: Adding a Mechwarrior
Post by: Autohummer on September 28, 2019, 04:29:20 am
If it works, pack everything. I want to add your pilot(s) to MCO, with your permission?

Two year later, I did it. (kind of. Some MW4Mercs pilots have the same name as those already in MCO, this causes problems as they refer to the wrong movie file when they say something.)

You may notice two blanks in the pilots_high file. I removed my two OC pilots that I added to test the system, so that this will be a pure MW4Mercs pilot addon. If you feel it needs to be filled, maybe I can add Spectre and Castle once I find and cut and pack their voice files.

Link here (30days only, grabwhenstillhot):
https://www.sendspace.com/file/nfou6c

EDIT: I only noticed after making this that it has already been implemented by Magic for the coming release. I am very sorry for the disappearance. However, this version works for the MCO628 version currently available for download, just overwrite the directory and edit the relevant purchase files to get the pilots, I hope this may be useful for those who want to play with MW4 Mercs pilots now on MCO628.
Title: Adding a Mechwarrior - this works for MC1/MCG, too!
Post by: RizZen on July 29, 2020, 02:18:30 am
Hi dear MCO community & magic,

sorry for gravedigging but i would like to report that this method works for MechCommander, too. Usually this should not be mentionable cause from neutral perspective MechCommander 1 / Gold should have pak-making tools when you look at the Modding Tools for it. But it turns out, that it had NO functioning exe file or working operator functions that allowed creating own voice- or sound packages for MechCommander.

At first i tried to create my voice package with Tigress tools. Tigress managed to create a small user interface for cMunsta's MC tools. Here a screenshot:

(https://i.imgur.com/86A3gTw.png)

The MCG-Tools.exe of it contains the cMunsta tools:

(https://i.imgur.com/ZAZS0Z6.png)

To make it short: Tigress tools...

(https://i.imgur.com/zwa4pSD.png)

This tool should allow unpacking & repacking of PAK file source for MechCommander. But in fact, the version i own doesn't pack new files. It can export any content of any pak file but the function to create NEW PAK files doesn't work.

After research i found this on GitHub (https://github.com/oseparovic/MCGExtract):

Code: [Select]
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <string.h>

/*
-----------------------------------------------------------------
PAK file format (Nearly identical to the SOL/PKK/MPK/SAV file formats)
000000 DWORD    PAK File Identifier (value is always 0xFEEDFACE)
000004 DWORD    Offset where file data actually starts
000008 DWORD*n  Table of offsets to the data in the file. (n is the table size)
                  - If an offset has a 0x40 in its high byte, it is compressed, and
    the true offset is (Offset & ~0x40000000) and the first DWORD
    at that offset is the uncompressed size.
      - If the offset has 0xE0 in its high byte, this entry is effectively
    empty.
Number of entries in table = ("DataStartOffset" - 8) / 4
-----------------------------------------------------------------
The following is actually just a quick modification of makesol.c, so if the comments
seem a bit odd at times, or the code a little redundant, you know why.
*/


typedef struct _PAK_Entry {
unsigned long Offset;
int compressed;
int empty;
struct _PAK_Entry *Next;
} PAK_Entry;


PAK_Entry *EntryList;
PAK_Entry *LastEntry;

long NumEntries;
long DataStartOffset;
unsigned long Checksum;

long tmpsize;


FILE *infile, *outfile, *tfile, *copyfile;

char cmd;
char filename[_MAX_PATH];
unsigned char *CopyBuffer;
unsigned char *CompressedBuffer;


extern long LZCompress(unsigned char *CompDataBuff, unsigned char *UncompDataBuff, unsigned long UncompDataSize);


void OutputAllData(void);
void AdjustDataForOutput(void);
void CreateTempDatafile(void);
void MakeNode(void);
void AddUncompressedFile(void);
void AddCompressedFile(void);
void AddEmptyEntry(void);



void main(int argc, char *argv[])
{
printf("-- makepak -- creates a PAK file from a file list --\n\n");

if(argc != 3)
{
printf("Usage: makepak <file list> <PAK file to create>\n");
exit(0);
}

if((infile = fopen(argv[1],"r")) == NULL)
{
printf("Can't open input file list '%s'\n",argv[1]);
exit(0);
}

if((outfile = fopen(argv[2], "wb+")) == NULL)
{
printf("Can't open output file '%s'\n",argv[2]);
exit(0);
}

if((tfile = fopen("$_temppak_$.dat","wb")) == NULL)
{
printf("Can't open temporary data file.\n");
exit(0);
}

CreateTempDatafile();

fclose(infile);

// Close and re-open the temporary file for reading
fclose(tfile);
if((tfile = fopen("$_temppak_$.dat","rb")) == NULL)
{
printf("Error -- Can't re-open temporary data file for reading\n");
exit(0);
}

AdjustDataForOutput();

fclose(tfile);

OutputAllData();

fclose(outfile);
}


void OutputAllData(void)
{
int x;
PAK_Entry *TOCEntry;

Checksum = 0xfeedface; // Don't have a checksum anymore, just an identifier of value "0xfeedface".
fwrite(&Checksum,4,1,outfile);
fwrite(&DataStartOffset,4,1,outfile);

TOCEntry = EntryList;
for(x=0;x<NumEntries;x++)
{
fwrite(&TOCEntry->Offset,4,1,outfile);

TOCEntry = TOCEntry->Next;
}

fwrite(CopyBuffer,1,tmpsize,outfile);
}


void AdjustDataForOutput(void)
{
int x;
long sizeread;
PAK_Entry *TOCEntry;

tmpsize = filelength(fileno(infile));

CopyBuffer = (unsigned char *)malloc(tmpsize);
if(CopyBuffer == NULL)
{
printf("Error -- Couldn't allocate buffer to copy the temp data\n");
exit(0);
}

sizeread = fread(CopyBuffer, 1,tmpsize, tfile);
if(sizeread != tmpsize)
{
printf("Error reading temporary data file into memory\n");
exit(0);
}

// Calc where the real data will start in the output file
DataStartOffset = (NumEntries * 4) + 8;

// Adjust the table of contents offsets, flag them as compressed or empty as needed.
TOCEntry = EntryList;
for(x=0; x<NumEntries; x++)
{
TOCEntry->Offset += DataStartOffset;

if(TOCEntry->compressed)
TOCEntry->Offset |= 0x40000000;

if(TOCEntry->empty)
TOCEntry->Offset |= 0xe0000000;

TOCEntry = TOCEntry->Next;
}
}


void CreateTempDatafile(void)
{
NumEntries = 0;
EntryList = NULL;
LastEntry = NULL;

while(!feof(infile))
{
fscanf(infile, "%c %s\n", &cmd, filename);

switch(cmd)
{
case 'c': // add as compressed file
AddCompressedFile();
break;

case 'u': // add as uncompressed file
AddUncompressedFile();
break;

case 'e': // add an empty entry to the TOC
AddEmptyEntry();
break;

default: // Unknown command, print error but keep going.
printf("Warning - Unknown command '%c'. Ignoring\n", cmd);
break;
}
}
}


void MakeNode(void)
{
PAK_Entry *NewNode;

NewNode = (PAK_Entry *)malloc(sizeof(PAK_Entry));
if(NewNode == NULL)
{
printf("Error allocating memory for TOC list\n");
exit(1);
}
NewNode->Next = NULL;
NewNode->Offset = 0;
NewNode->compressed = 0;
NewNode->empty = 0;

if(EntryList == NULL)
{
EntryList = NewNode;
}

if(LastEntry != NULL)
{
LastEntry->Next = NewNode;
}

LastEntry = NewNode;
}


void AddEmptyEntry(void)
{
MakeNode();

LastEntry->empty = 1;
LastEntry->compressed = 0;
LastEntry->Offset = ftell(tfile);

NumEntries++;
}


void AddUncompressedFile(void)
{
long fsize;
long sizeread;
long sizewritten;

if((copyfile = fopen(filename,"rb")) == NULL)
{
printf("Error -- can't open file %s\n", filename);
exit(1);
}

fsize = filelength(fileno(copyfile));

CopyBuffer = (unsigned char *)malloc(fsize);
if(CopyBuffer == NULL)
{
printf("Error -- Couldn't allocate buffer to copy %s.\n",filename);
exit(1);
}

sizeread = fread(CopyBuffer,1,fsize,copyfile);
if(sizeread != fsize)
{
printf("Error reading file %s\n",filename);
exit(1);
}

fclose(copyfile);

MakeNode();

LastEntry->compressed = 0;
LastEntry->empty = 0;
LastEntry->Offset = ftell(tfile);

sizewritten = fwrite(CopyBuffer,1,fsize,tfile);
if(sizewritten != fsize)
{
printf("Error writing %s to tempfile.\n",filename);
exit(1);
}

free(CopyBuffer);

NumEntries++;
}


void AddCompressedFile(void)
{
long fsize;
long sizeread;
long sizecompressed;
long sizewritten;

if((copyfile = fopen(filename,"rb")) == NULL)
{
printf("Error -- can't open file %s\n", filename);
exit(1);
}

fsize = filelength(fileno(copyfile));

CopyBuffer = (unsigned char *)malloc(fsize);
if(CopyBuffer == NULL)
{
printf("Error -- Couldn't allocate buffer to copy %s.\n",filename);
exit(1);
}

sizeread = fread(CopyBuffer,1,fsize,copyfile);
if(sizeread != fsize)
{
printf("Error reading file %s\n",filename);
exit(1);
}

fclose(copyfile);

// Since pretty much everything is a text file, we shouldn't have to worry about the
// data growing instead of shrinking, but it is technically possible.
CompressedBuffer = (unsigned char *)malloc(fsize);
if(CompressedBuffer == NULL)
{
printf("Error -- Couldn't allocate buffer to compress %s.\n",filename);
exit(1);
}

sizecompressed = LZCompress(CompressedBuffer, CopyBuffer, fsize);

MakeNode();

LastEntry->compressed = 1;
LastEntry->empty = 0;
LastEntry->Offset = ftell(tfile);

// Compressed files have the uncompressed file size stored in the first DWORD of the file data.
fwrite(&fsize,4,1,tfile);

sizewritten = fwrite(CompressedBuffer,1,sizecompressed,tfile);
if(sizewritten != sizecompressed)
{
printf("Error writing %s to tempfile.\n",filename);
exit(1);
}

free(CopyBuffer);
free(CompressedBuffer);

NumEntries++;
}

I have to repeat. Nice to have the source code for this exe file or function - but using it for creating my own BAT is - at the moment - out of my limits. My exe modding skills are hex-editing only.
The next step i took was searching for information about PAK files in general and found one solution that possibly could have work: Just compressing the voice files as *.zip / *.rar file, rename it to *.PAK... - this method although didn't work for MechCommander - and i found out why on gameextractor.sourceforge.net (http://gameextractor.sourceforge.net/program/archives.txt):

Code: [Select]
+---------------------+
| GENERAL INFORMATION |
+---------------------+

This file describes many different archive formats used by games. You can use these
specifications to help you create your own programs, or to give you an insight into
the information contained in a particular file.

** NOTE: Some specifications are not complete. **

There is absolutely NO GUARENTEE that the information within this document is correct!
All information has been obtained through experimentation and investigation only, no
information has been verified by the associated companies or game developers.

For better clarification of format structures, and for additional formats not listed
here, be sure to download the source code for Game Extractor (http://www.watto.org/extract)
as it contains fully commented Java code for reading and writing many game archives,
and is free for use by anyone.

If you have any information that you can add to this file, including new archives and
corrections, please contact WATTO at [email protected] - your help is greatly appreciated!


+-----------------------+
| HOW TO READ THIS FILE |
+-----------------------+

* General comments are indicated by a // at the start of the line
* Comments for a particular line are written within ( ) at the end of the line

* A number at the start of a line is the number of bytes used to store the value
* The text to the right of a number is a description of the value
* Information in ( ) to the right of a description, is the default value of the field
* Information in [ ] to the right of a description, is a calculation to apply to the field

* A ? in the description indicates that the description may not be correct
* An X at the start of the line (in place of a number) shows a variable number of bytes

* A line with "X - Filename (null)" indicates that the filename is read up to the first null byte
* A line with "# - Filename (null)" indicates that the filename has a maximum length of # bytes,
  and the remaining space is filled with null bytes
* The statement (big) next to a game name indicates that the archive uses big-endian order
  (all others use little-endian)
* The statement (chunk) next to a game name indicates the use of a variation on the EA IFF'85
  chunk format

* In most directory-based archives, the file data follows the directory. Unless it is otherwise
  indicated where the file data is located, this should be assumed, thus read the specs for the
  game and the file data will follow directly after.

* X - File Data indicates that the data for each file is located in this area, with each
  file's data stored one after the other

and for MechCommander 1 / 2 those value tables:

Code: [Select]
+----------------------+
| Mech Commander *.pak |
+----------------------+

4 - Header (206 250 237 254)
4 - First File Offset

// for each file
  3 - File Offset
  1 - Flags?

X - File Data


+------------------------+
| Mech Commander 2 *.fst |
+------------------------+

// Some or all files are compressed using ZLIB?

4 - Header (175 236 221 202)
4 - numFiles

// for each file
  4 - File Offset
  4 - File Size
  4 - Unknown
  4 - Unknown
  250 - Filename (null)

X - File Data

... so i decided to add the missing hex lines into the PAK files. This didn't worked for the RAR/ZIP versions either. Then i compared the only functioning customermade voice package i have with the original PAK files and saw that PAK files are very familiar looking to *.PKK / *.MPK / *.SOL / *.SAV file extension compression methods. But i didn't wanted to create the pack file like this cause they have no prior header that would probably be used by the game engine. In order to not run into another dead-end...

... i started digging for information here in this thread  and found the tools you have used for MechCommander 2 / OmniTech modding. For this i have to thanks Autohummer and of course... - again... magic for the work they have done!

So this solution works for MechCommander 1 / Gold - Voice Packages:

I have found and downloaded you MC2 tools


By using the mkPilot_PAK.bat & a simple response file list (Pilot.rsp)...

Code: [Select]
Pilot01.wav
Pilot02.wav
Pilot03.wav
Pilot04.wav
Pilot05.wav
Pilot06.wav
Pilot07.wav
Pilot08.wav
Pilot09.wav
Pilot10.wav
Pilot11.wav
Pilot12.wav
Pilot13.wav
Pilot14.wav
Pilot15.wav
Pilot16.wav
Pilot17.wav
Pilot18.wav
Pilot19.wav
Pilot20.wav
Pilot21.wav
Pilot22.wav
Pilot23.wav
Pilot24.wav
Pilot25.wav
Pilot26.wav
Pilot27.wav
Pilot28.wav
Pilot29.wav
Pilot30.wav
Pilot31.wav
Pilot32.wav
Pilot33.wav
Pilot34.wav
Pilot35.wav
Pilot36.wav
Pilot37.wav
Pilot38.wav
Pilot39.wav
Pilot40.wav
Pilot41.wav
Pilot42.wav
Pilot43.wav

... i could write a BEAST.PAK file. Yeah the bat file only creates soundpackages with this file name. But this is no big deal at all - i simply renamed the file into RizZ.PAK and implemented this into MechCommander. With the compression system of MC2 it works like a charme. I can hear my new pilots sounds ingame and it is absolutely working like a charme - AND with better sound quality cause MC2 used a bit higher technical settings for wav file compression.

(https://i.imgur.com/r09lNKT.jpg)

So thank you again, dear modding community. This allows me to finally introduce one of the last missing elements in my Fullversion MechCommander Gold Darkest Hours (https://www.moddb.com/games/mechcommander-gold/news/what-is-mcg-darkest-hours-all-about) - the implementation of 20 new voice packages for customermade MechWarriors. I have my own voice package containing cringe predator sounds hehe!

Regards RizZen

Edit: Another question: May anyone of you create an extracted mechwarrior sound file package out of MC2 / OmniTech for me. Actually im thinking about creating MC2 warriors in MC1 hehe ^^