.arc File extension

Discussion in 'NDS - ROM Hacking and Translations' started by Gryphon93, Aug 5, 2009.

Aug 5, 2009

.arc File extension by Gryphon93 at 6:16 PM (4,605 Views / 0 Likes) 19 replies

  1. Gryphon93
    OP

    Member Gryphon93 GBAtemp Regular

    Joined:
    Nov 30, 2008
    Messages:
    145
    Country:
    Sweden
    I've unpacked Time Hollow and found out that almost everything is packed in .arc-files (archives). I'm wondering if it exists any tools to extract the files from the archive, or if it at least exists somekind of reference/documentation?

    Now, before you say "Use NARCTool" I would like to say that this kind of .arc-format isn't the same as the other .arc-format for DS. I've tried to use NARCTool, but without any luck. I've also tried to use some tools made for the GC/Wii .arc-format, but (as I excepted) they didn't work either. Well, if there's no reference/documentation nor tools to extract the archive, please help me find out how to extract this kind of .arc-files. I've already "researched" a little by myself. This is what I've come up with so far:

    Reference/Documentation (Not complete and not sure that it's correct):
    Code:
    OffsetÂÂÂÂÂÂÂÂSize ÂÂÂÂDescription
    0x00000000ÂÂÂÂ0x4ÂÂÂÂÂÂÂÂ"Magic ID"ÂÂÂÂÂÂÂÂ// Always "ARCH"
    0x00000004ÂÂÂÂ0x4ÂÂÂÂÂÂÂÂNo. of Files
    0x00000008ÂÂÂÂ0x4ÂÂÂÂÂÂÂÂName Table Offset
    0x0000000cÂÂÂÂ0x4ÂÂÂÂÂÂÂÂINFO-OffsetÂÂÂÂ// Not sure if this is part is called INFO, but that's what I call it for now
    0x00000010ÂÂÂÂ0x4ÂÂÂÂÂÂÂÂFILE-OffsetÂÂÂÂ
    0x00000014ÂÂÂÂ0x4ÂÂÂÂÂÂÂÂHEADER-size (in bytes)
    0x00000020ÂÂÂÂ0x4ÂÂÂÂÂÂÂÂFile size (?)
    0x00000024ÂÂÂÂ0x4ÂÂÂÂÂÂÂÂNo. of Files (again?)
    And here is a small dump from the program I made to read the .arc-files:
    Code:
    D00_00_00.arcÂÂÂÂ // Found in data\bg\digging
    ARCH
    11
    32
    208
    384
    432
    176
    11
    // This is NOT in Hex
    You can find the .arc-files in Time Hollow. Almost everything is in .arc-archives.

    All help is appreciated! Thanks in advance!

    [EDIT] Updated the "reference". Please help me complete it!
    [EDIT 2] Thanks to Barubary for his help finding out everything about the format!
     
  2. Gryphon93
    OP

    Member Gryphon93 GBAtemp Regular

    Joined:
    Nov 30, 2008
    Messages:
    145
    Country:
    Sweden
    Sorry for double posting, but I really want/need help... I want help with finding out if the file data is compressed (which I belive it is) and what kind of compression method that's used (maybe somekind of LZ-compression?). I hope someone can help me. I really want the files in these archives. This is the first time I'm trying to something like this. I mean, understand a file format, make the reference myself and so on. Please, ALL help is appreciated!
     
  3. DarthNemesis

    Member DarthNemesis GBAtemp Maniac

    Joined:
    Feb 19, 2008
    Messages:
    1,208
    Country:
    United States
    LZ-compressed files can be identified by a starting byte of 0x10 or 0x11 followed by a 3 byte length and a flag byte (the first one should always be 00) before the actual file data begins. If you see a signature at the very start of the file rather than 5 bytes in, it's not likely to be compressed (but if it's an archive, the individual files inside it could still be compressed once you've extracted them).
     
  4. Gryphon93
    OP

    Member Gryphon93 GBAtemp Regular

    Joined:
    Nov 30, 2008
    Messages:
    145
    Country:
    Sweden
    Hm... Alright... I think I got that. So the archives are probably not compressed (if I've understood the last part of your post correctly), since the first bytes in the whole archive are ARCH (HEX: 41 52 43 48). Well, I've probably misunderstood what you said, but hopefully the files aren't compressed. (It will be much easier that way, I think)
     
  5. Barubary

    Newcomer Barubary Member

    Joined:
    Feb 27, 2009
    Messages:
    28
    Country:
    United States
    Indeed, the archives themselves are not compressed, but the files inside are (or otherwise encrypted).


    This seems to be the format of the ARCH-files;
    Code:
    typedef struct {
    char[4] magicHeader; // 'ARCH'
    u32 numFiles;
    u32 nameTableOffset;
    u32 fatOffset;
    u32 nameIndexOffset;
    u32 dataOffset;
    } ARCHHeader
    
    typedef struct {
    u32 sectionSize;
    u32 numNames; // practically always the same as numFiles
    char** names; // 'numNames' 0-terminated strings
    } NameTable
    
    typedef struct {
    u32 fileLength;
    u32 unknown1; // flags? seem to be (almost) the same per filetype
    u32 fileStart; // relative to dataStart
    u16 nameOffset; // offset of name in NameTable. relative to start of NameTable section
    u16 unknown2; // ??? constant 1? amount of similar files directly following afterwards perhaps?
    } FileAllocation
    
    typedef struct {
    FileAllocation[numFiles] fat;
    } FileAllocationTable
    
    typedef struct {
    u16 index;
    u16 nameOffset;
    } NameIndexEntry
    // from what I've seen, this section has little added value. It seems to bind file numbers with their names, but that's already done in the FAT.
    // the 'index'th FileAllocation in the FAT has the same nameOffset as defined here
    
    typedef struct {
    NameIndexEntry[numFiles] nit;
    } NameIndexTable // (I'm just calling it something that sounds like what the section seems to be)
    However, I've no idea of the compression/encryption technique used in the files inside.
     
  6. Gryphon93
    OP

    Member Gryphon93 GBAtemp Regular

    Joined:
    Nov 30, 2008
    Messages:
    145
    Country:
    Sweden
    Wow! Thanks a lot Barubary! This will be VERY useful! Thank you! I got stuck at the FILE-part. I could only figure out the HEADER (almost)...

    [EDIT] Do you think I can use NARCTool's source when I make the ARCTool? I mean, just use the functions and stuff, but changing the header-file (and the other things that have to be changed). Or is it possibly easier to make the whole thing from scratch? I'm planning to make it in Ruby.
     
  7. Gryphon93
    OP

    Member Gryphon93 GBAtemp Regular

    Joined:
    Nov 30, 2008
    Messages:
    145
    Country:
    Sweden
    Sorry for bringing my "old" topic back up, but I just want to ask you (again...) for some help.

    I'm working on a utility that'll be able to extraxt and (hopefully) pack .arc-files. What I want help with is the few things that are still unknown about the ARCH-format. As you can see in Barubary's code, there's some things that we don't know what they are for and what they mean. I hope someone can help me find out what these things are and tell me. It may be something that's needed to extract/pack the .arc-files.

    Thanks a lot in advance! I really appreciate all your help! Thanks for all the help you've already given me!

    [EDIT] I'm almost there! I hope it isn't much left to do before I'm able to extract the .arc-files. I just have to read the data and save it as files.
     
  8. Gryphon93
    OP

    Member Gryphon93 GBAtemp Regular

    Joined:
    Nov 30, 2008
    Messages:
    145
    Country:
    Sweden
    Alright, sorry for triple-posting... Really, sorry. I just want to report my progress.

    I'm now able to extract the files from the archives, but now I've to find out what kind of compression-method that's used.

    Again, I would like to ask for your assistance. I want to know what compression-method that's used, and to help you a bit I'll post some files here for you.

    Download link (extracted_files.rar)

    I hope you're able to help me. It's the last thing I need to finish the extract-function.
     
  9. Marvin Dalkiri

    Newcomer Marvin Dalkiri Member

    Joined:
    Mar 1, 2009
    Messages:
    10
    Country:
    Brazil
    Well, I've checked your files, and as far as I know, these aren't any of the DS standard compressions.

    However, these could be some sort of flagless LZSS, or something like that.

    I'm gonna check again these files later when I get home, and see what I can find uot about them.
     
  10. Gryphon93
    OP

    Member Gryphon93 GBAtemp Regular

    Joined:
    Nov 30, 2008
    Messages:
    145
    Country:
    Sweden
    Thanks a lot! Just hearing that you've checked the files are great news for me! I'm also checking them. I comparing the files with other files with the same extensions to see if I can figure something out.

    Oh, something I forgot to say earlier. It seems like the 4 first bytes are (almost) always FE 7F. Mabye that can help anything.
     
  11. DarthNemesis

    Member DarthNemesis GBAtemp Maniac

    Joined:
    Feb 19, 2008
    Messages:
    1,208
    Country:
    United States
    The last 2 bytes before the file signature (RLCN, RCGN, etc.) hold the length of the compressed data.
     
  12. Gryphon93
    OP

    Member Gryphon93 GBAtemp Regular

    Joined:
    Nov 30, 2008
    Messages:
    145
    Country:
    Sweden
    Nice! Thanks for the information, Darth Nemesis. I really appreciate it. As soon as I know what kind of compression method that's used, I'll be able to finish the extract-function and begin to work on the packing-function.
     
  13. Xerawels

    Newcomer Xerawels Newbie

    Joined:
    Oct 9, 2009
    Messages:
    1
    Country:
    France
    Hey Gryphon ! Do your researches advance ? Me too, I would really like to be able to change the .arc files of Time Hollow !
     
  14. azure0wind

    Member azure0wind 7 years flew so fast.

    Joined:
    May 24, 2009
    Messages:
    941
    Country:
    Indonesia
    off topic [​IMG]
    anyway now, what do you want to help with? [​IMG]
     
  15. Midou23000

    Newcomer Midou23000 Newbie

    Joined:
    Dec 21, 2014
    Messages:
    9
    Location:
    Annaba, Algeria
    Country:
    Algeria
    What about ARC files from 3Ds carts like Super street fighter 4 3D edition i decrypt the ROM but i can open the ARC extension for some mods ^^ please help me :wacko:
     
  16. Februarysn0w

    Member Februarysn0w 光井ほのか

    Joined:
    Oct 31, 2014
    Messages:
    1,168
    Location:
    Somewhere on the earth
    Country:
    Fiji
    Try this ARC tool. I successfully unpacked Arc files that come with MH4G (JPN). Just drag and drop your file to "pc-re6-extract.bat" or "pc-re5-extract.bat".
     

    Attached Files:

  17. Midou23000

    Newcomer Midou23000 Newbie

    Joined:
    Dec 21, 2014
    Messages:
    9
    Location:
    Annaba, Algeria
    Country:
    Algeria
  18. Midou23000

    Newcomer Midou23000 Newbie

    Joined:
    Dec 21, 2014
    Messages:
    9
    Location:
    Annaba, Algeria
    Country:
    Algeria
    not work for me :cry:
     
  19. Midou23000

    Newcomer Midou23000 Newbie

    Joined:
    Dec 21, 2014
    Messages:
    9
    Location:
    Annaba, Algeria
    Country:
    Algeria
  20. Kelebek

    Member Kelebek GBAtemp Regular

    Joined:
    May 25, 2012
    Messages:
    165
    Country:
    United Kingdom
    Februarysn0w likes this.

Share This Page