Cyberlore Majesty Forum Forum Index Cyberlore Majesty Forum
Original Majesty Forum on Cyberlore.com


Majesty voice files, where?

 
Post new topic   Reply to topic    Cyberlore Majesty Forum Forum Index -> Majesty Technical Assistance
View previous topic :: View next topic  
amdi8



Joined: 30 Sep 2005
Posts: 3

 PostPosted: Fri Sep 30, 2005 8:40 am    Post subject: Majesty voice files, where? Reply with quote Back to top

I'd love to download some of the Majesty voice files. Any idea where I can get them from?

I know about fileplanet, but they require Windows for their stupid plugin and they're always busy anyway.

Does anybody have them available from a fan site? Otherwise, if somebody has them and could put them up somewhere, that would be great. In particular, I'm looking for the elf, gnome, and dwarf voice lines.

Alternatively, does anybody know how to extract them from the voices.cam file from the game?

Thanks!
 
View user's profile Send private message
amdi8



Joined: 30 Sep 2005
Posts: 3

 PostPosted: Fri Sep 30, 2005 6:53 pm    Post subject: Reply with quote Back to top

All right. Since this forum isn't exactly bursting with activity, I figured I'd have to get the sounds by myself. So I wrote a quick and dirty program to extract all the wav files.

In case anybody finds it useful, here it is. Enjoy.

Code:

#include <stdio.h>


bool ExtractWavs (const char* filename)
{
    FILE* fin = fopen(filename, "rb");
    if (fin == 0)
    {
        printf ("Could not open %s\n", filename);
        return false;
    }
   
    int wavsFound = 0;
    while (!feof(fin))
    {
        char sig = '0';
        fread(&sig, 1, 1, fin);
        if (sig != 'R')
            continue;
        fread(&sig, 1, 1, fin);
        if (sig != 'I')
            continue;
        fread(&sig, 1, 1, fin);
        if (sig != 'F')
            continue;
        fread(&sig, 1, 1, fin);
        if (sig != 'F')
            continue;   
     
        unsigned int size = 0;
        fread(&size, sizeof(size), 1, fin);

        unsigned char* data = new unsigned char[size];
        fread (data, 1, size, fin);
        if (data[0] != 'W' || data[1] != 'A' || data[2] != 'V' || data[3] != 'E')
        {       
            delete [] data;
            continue;               
        }
               
        printf ("Wav found %d bytes\n", size);
       
        {
            char outFilename[256];
            sprintf (outFilename, "sound%03d.wav", wavsFound);
            FILE* fout = fopen(outFilename, "wb");
            if (fout == 0)
            {
                printf ("Could not open %s for writing", outFilename);
                return false;
            }
               
            unsigned int header = 0x46464952;
            fwrite (&header, sizeof(header), 1, fout);
            fwrite (&size, sizeof(size), 1, fout);
            fwrite (data, size, 1, fout);                       
               
            fclose (fout);       
        }       
       
        delete [] data;
       
        ++wavsFound;
    }
   
    fclose(fin);
   
   
    printf ("Total wavs found: %d\n", wavsFound);
    return true;
}



int main ( int argc, char **argv )
{
    if (argc != 2)
    {
        printf ("Usage: extractwav filename\n\n");
        return 1;
    }
   
    const char* filename = argv[1];
    if (!ExtractWavs(filename))
        return 1;
       
    return 0;
}
 
View user's profile Send private message
Alfryd



Joined: 03 Dec 2002
Posts: 914

 PostPosted: Sat Oct 01, 2005 6:35 am    Post subject: Reply with quote Back to top

Many thanks! Are you using OSX, Linux or some other OS? My C++'s a little rusty, but I'll see if I can code this up in Java for convenience. How did you figure this out, anyways?
_________________
The living are a species of the dead, and a very rare species.
 
View user's profile Send private message
amdi8



Joined: 30 Sep 2005
Posts: 3

 PostPosted: Sat Oct 01, 2005 11:14 am    Post subject: Reply with quote Back to top

I'm using Linux but it should work on Windows just as well.

For MacOSX, you're big endian, so you need to reverse the magical word that gets written out

Code:

            unsigned int header = 0x46464952; // change this to 0x52494646 for Macs
            fwrite (&header, sizeof(header), 1, fout);
            fwrite (&size, sizeof(size), 1, fout);
            fwrite (data, size, 1, fout);     


Or you can write it in a better, endian-independent way, but this is supposed to be a quick ugly hack to get the wavs out :-)

As for how I figured it out, I just opened up the voices file with a hex editor and started searching for mp3, wav, or ogg, figuring that it would be one of those formats. It turns out that wav files are simply stored in their original format there as I suspected, so it was just a matter of parsing the file looking for the wav header and saving them out separately. For more details, check out http://www.sonicspot.com/guide/wavefiles.html
 
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cyberlore Majesty Forum Forum Index -> Majesty Technical Assistance All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum