Reverse engineering a world map file

Page 1 of 2 12 LastLast
Results 1 to 15 of 27
  1. #1
    Member AcarX is offline
    MemberRank
    Aug 2015 Join Date
    79Posts

    Reverse engineering a world map file

    Reverse engineering a world map file
    I was wondering if anyone is familiar with the map file format ".ma1, .ma2" or at least its structure in general. If not, how would I go about figuring out the structure of a world map file? Thanks in advance.

    Samples


  2. #2
    LT-JT-Fanatic Zenshin112 is offline
    True MemberRank
    May 2012 Join Date
    314Posts

    Re: Reverse engineering a world map file

    Did You get The source for The Game reading it? If yes You Can look there how its read ans know what is what. Else search by using hex editor for The header. This mostly have The needed informations. The offset for The vertices, polygons, objects, fileversion, etc. I am only a newbie at This. It's More a trying to find The right values. Without having The source or else its pretty hard. I recommend You using 010 editor. And Look at xentax for some tutorials.
    time out

  3. #3
    only asm, only hardcore! lastfun is offline
    DeveloperRank
    Apr 2012 Join Date
    RussiaLocation
    422Posts

    Re: Reverse engineering a world map file

    [STRIKE]what game?[/STRIKE]
    Archlord
    Last edited by lastfun; 19-05-16 at 03:30 PM.

  4. #4
    Member AcarX is offline
    MemberRank
    Aug 2015 Join Date
    79Posts

    Re: Reverse engineering a world map file

    @lastfun
    Yep.
    @Zenshin112
    I do not have the source sadly. I've tried using notepad++ with the hex editor plugin but couldn't make much sense of it. I'll keep trying.

  5. #5
    Reverse engineering a world map file Future is offline
    LegendRank
    Dec 2011 Join Date
    2,275Posts

    Re: Reverse engineering a world map file

    Looks to me like a 51 bytes long header followed by several entries.
    The entries seem to always start with 0xC0 (maybe a token declaring a new entry) and a string (maybe containing the file name) trailed by a 4 byte large value that could be an integer or something indicating the data length probably:



    Sorry for the shitty illustration, I didn't have much time.

    Maybe that already gets you somewhere, I have limited time atm. but I could try some parsing tomorrow. Doesn't look too difficult to find out. By the extension names like .dff it's highly likely those are DirectX resource files.


    Quote Originally Posted by A Wise Man
    P-Servers are NOT dead. Bugs need squishing. Quests need fixing. Unfortunately, majority of people don't know the difference between a computer and a toaster so...

  6. #6
    Member AcarX is offline
    MemberRank
    Aug 2015 Join Date
    79Posts

    Re: Reverse engineering a world map file

    @Future
    Thanks for taking the time to check it out. I believe 0x0C is the length of the file name. Dff is I believe the 3D file format for the renderware engine(which is the engine this game was built in). I tried to figure out if the data part was repeating itself or had something to do with the blue marked parts but didn't have much success yet.

  7. #7
    LT-JT-Fanatic Zenshin112 is offline
    True MemberRank
    May 2012 Join Date
    314Posts

    Re: Reverse engineering a world map file

    Jeah thats what i meaned :O
    time out

  8. #8
    only asm, only hardcore! lastfun is offline
    DeveloperRank
    Apr 2012 Join Date
    RussiaLocation
    422Posts

    Re: Reverse engineering a world map file

    @AcarX


    offset for first file name (byte file name length):
    long offset = 0x32;

    struct header see in screen
    xor body length:
    Code:
      byte[] key = { 0x69, 0x69};
      var f_size = reader.ReadBytes(4);  //blue in header screen
                  for (int x = 0; x < key.Length; x++)
                  {
                     f_size[x] = (byte)(key[x] ^ f_size[x]);
                  }
    and one small problem))) body file is compressed (so it seems to me, did not look in detail, the time is not... look later)
    Last edited by lastfun; 20-05-16 at 10:12 AM.

  9. #9
    Member AcarX is offline
    MemberRank
    Aug 2015 Join Date
    79Posts

    Re: Reverse engineering a world map file

    Thanks @lastfun
    I couldn't have thought of that ever. [STRIKE]Although I seem to fail to get same results in C[/STRIKE]. Got the same results as well. Is the key same for all files or?

    Edit: For .ma2 files 0x1485 seems to be the separator.
    Last edited by AcarX; 20-05-16 at 10:50 AM.

  10. #10
    only asm, only hardcore! lastfun is offline
    DeveloperRank
    Apr 2012 Join Date
    RussiaLocation
    422Posts

    Re: Reverse engineering a world map file

    Yes, for all (100% for *.ma1, for ma2 i'm not looking, but it should be the same )

  11. #11
    Reverse engineering a world map file Future is offline
    LegendRank
    Dec 2011 Join Date
    2,275Posts

    Re: Reverse engineering a world map file

    Thanks for donig the work @lastfun :P
    I would have taken a look at it now but I see you're already into it.

    How did you fiddle out that the length is XORed and the key for it as well?


    Quote Originally Posted by A Wise Man
    P-Servers are NOT dead. Bugs need squishing. Quests need fixing. Unfortunately, majority of people don't know the difference between a computer and a toaster so...

  12. #12
    only asm, only hardcore! lastfun is offline
    DeveloperRank
    Apr 2012 Join Date
    RussiaLocation
    422Posts

    Re: Reverse engineering a world map file

    Quote Originally Posted by Future View Post
    ...
    How did you fiddle out that the length is XORed and the key for it as well?
    )))

  13. #13
    Member AcarX is offline
    MemberRank
    Aug 2015 Join Date
    79Posts

    Re: Reverse engineering a world map file

    I believe those 'separators' are also being xor'ed and being used to allocate memory for data. From what I could dig up in assembly something like:

    Code:
    size_t dataSize = separator ^ 0x6969;
    if(dataSize > SOME_CONSTANT)
    	; // error checking
    else
    	char* memoryPtr = new char[dataSize]; // memoryPtr seems to be a fixed address instead of a local variable
    I guess this is it as far as the file structure goes. I would love some help with parsing the contents of data parts but it might be too much to ask for.

  14. #14
    Reverse engineering a world map file Future is offline
    LegendRank
    Dec 2011 Join Date
    2,275Posts

    Re: Reverse engineering a world map file

    I agree with you @AcarX that value looks like an offset or length definition to me. A 4 byte val (uint32 / int32) typically looks like some kind of size definition and it's right behind the file name of each entry.


    Quote Originally Posted by A Wise Man
    P-Servers are NOT dead. Bugs need squishing. Quests need fixing. Unfortunately, majority of people don't know the difference between a computer and a toaster so...

  15. #15
    only asm, only hardcore! lastfun is offline
    DeveloperRank
    Apr 2012 Join Date
    RussiaLocation
    422Posts

    Re: Reverse engineering a world map file

    I would love some help with parsing the contents of data parts but it might be too much to ask for.
    no, not much)
    I (later, ~4-5h) will continue to parse this pack...
    I'm not sure exactly, but i think it's just a marker (0x6d79)
    I'm more worried about the file body compress method (if there is one), need take any *.amf and compared with that in the pack



Page 1 of 2 12 LastLast

Advertisement