Author Topic: Adding a Mechwarrior  (Read 10137 times)

0 Members and 1 Guest are viewing this topic.

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)

 

Offline magic

  • Moderator
  • 211
 :yes:

 
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).

 
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?

 

Offline magic

  • Moderator
  • 211
Yes, I can test.

How you did mw4 pilots?
There are too few sounds for transfer to MCO?

 
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)
« Last Edit: April 05, 2017, 11:29:09 am by Autohummer »

 

Offline magic

  • Moderator
  • 211
Then try without them...

Please send me unpacked sound files for some of MW4 pilots.

 
https://www.sendspace.com/file/g3bf7v
Here we go. The "New folder" inside each named folder contains the files I added to the .pak.

 

Offline magic

  • Moderator
  • 211
Re: Adding a Mechwarrior
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..

 
Re: Adding a Mechwarrior
Thanks for the tip, working on it now.

 
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.
« Last Edit: September 28, 2019, 04:38:26 am by Autohummer »

 
Adding a Mechwarrior - this works for MC1/MCG, too!
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:



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



To make it short: Tigress tools...



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:

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:

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

  • mkPilot_PAK.bat
  • unpackPilot_PAK.bat
  • XPList.exe

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.



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 - 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 ^^
« Last Edit: July 29, 2020, 02:56:08 am by RizZen »
It has become appalingly obvious that our technology has exceeded our humanity.

Albert Einstein