Page 1 of 1

Posted: Tue Mar 21, 2006 4:35 pm
by Wismuth
While playing around with a hex editor I discovered that the length of each film is encoded as an integer multiple of 1/30 seconds in the 4 bytes starting at offset 0x48 of the file. The length includes Planning Time and 10.00 seconds of "Messing Around Time" after the game is over.

Below is a C program which will decode and display the length of each film given as a command line argument.

Code: Select all

#include <stdio.h>
#include <assert.h>

int main(int argc, char *argv[])
{
    FILE *fp;
    int a, b, c, d;
    int length;
    int i;

    for (i = 1; i < argc; i++) {
        fp = fopen(argv[i], "r");
        assert(fp != NULL);
        fseek(fp, 0x48, SEEK_SET);
        a = fgetc(fp); assert(a != EOF);
        b = fgetc(fp); assert(b != EOF);
        c = fgetc(fp); assert(c != EOF);
        d = fgetc(fp); assert(d != EOF);
        length = a<<24 | b<<16 | c<<8 | d;
        if (length == 0)
            printf("partial film  %s\n", argv[i]);
        else {
            length -= 10*30;
            printf("%d:%02d:%02d.%02d -- %s\n",
                length/30/60/60,
                length/30/60%60,
                length/30%60,
                (length*10+1)/3%100,
                argv[i]);
        }
        fclose(fp);
    }
}
Example of usage (details vary depending on the Operating System):

Code: Select all

> filmlength recordings/Netgame-\ Mar*
0:24:41.60 -- recordings/Netgame- Mar 01 05.07.55 2006
0:22:20.80 -- recordings/Netgame- Mar 10 02.25.40 2006
1:12:30.93 -- recordings/Netgame- Mar 21 06.40.00 2006
The program automatically subtracts the 10 seconds of Messing Around Time so as to display the exact time of Defeat or Victory in Coop games. Unfortunately Planning Time is still included so that a 7min KOTH game with 30sec PT will show up as 0:07:30.00 (assuming it didn't end early).

Films that are incomplete because Myth crashed during the game have no timing information and are displayed as "partial film".

Running the program on zipped films or other kind of files will return non-sensical information. No attempt is made to detect that a file is not a film.[/color]

Posted: Wed Mar 22, 2006 11:39 am
by Doobie
Are you familiar with Baak's myth film tools? I suspect his have this functionality already (and much much more).

gj anyhow

Posted: Thu Mar 23, 2006 9:32 pm
by William Wallet
I tried hex-editing a multiplayer film that had a lot of very brutal arguing in it, so that all the names would be changed to the names of the PlayMyth admins.
It didn't work :(