100 Classic Books - File Formats

Discussion in 'NDS - ROM Hacking and Translations' started by Keshire, Mar 19, 2012.

Mar 19, 2012
  1. Keshire
    OP

    Member Keshire GBAtemp Regular

    Joined:
    Sep 8, 2007
    Messages:
    145
    Country:
    United States
    It'd be nice if the homebrew readers had the kind of polish that this commercial rom does. It also supports images which is nice.

    Anyways, I decided to take a look at the files to see how difficult it'd be to write a book importer.
    The books themselves are located in ./data/eile

    Here is the format:
    byte 8bits, short 16bits, long 32bits
    Code:
    typedef struct {
    // Header for the file
    ubyte    Unknown[16];
    ulong     FileTypes; //Maybe??
    ulong     FileOffsets[28]; //to Compressed NARCs
    ulong     FileSizes[28];// size of compressed NARCs
    } BookRecord;
    
    The bulk of the book is in the .BD files. They are plaintext and use a markup language similar to HTML. Like so:
    Code:
    
    Alice's Adventures in Wonderland
    
    Lewis Carroll
    
    
    
    
    You can't think how glad I am to see you again, you dear old thing!
    
    but there were three gardeners at it,
    with a great crowd assembled about themall sorts of little birds and beasts,
    
    I don't think it'd be all that hard to write a converter. I still need to see if the wifi books are stored the same way though.
     
    1 person likes this.
  2. Sora de Eclaune

    Member Sora de Eclaune Baby squirrel, you's a sexy motherfucker.

    Joined:
    Feb 15, 2011
    Messages:
    2,785
    Location:
    123 Fake Street
    Country:
    United States
    Interesting that it supports images. This could mean that if we get to importing new books into the ROM, we could import books where images are crucial to the story instead of reading the book through DSReader and not have the images to look at.
     
  3. Vampire Lied

    Member Vampire Lied Resident sociopath

    Joined:
    May 27, 2011
    Messages:
    628
    Location:
    somewhere
    Country:
    United States
    That would be awesome! I actually wondered if inserting your own books was possible.
    If a converter/importer gets made, this'll be the best book reading app!
    I'd love to rip out most of the default books and insert my own.
     
  4. Keshire
    OP

    Member Keshire GBAtemp Regular

    Joined:
    Sep 8, 2007
    Messages:
    145
    Country:
    United States
    Looks like the Wifi books are stored in the same format inside the save. If I knew how I'd try and grab the books before they hit the DS to see if the whole thing could be spoofed. Setting up a local server on the PC to send and receive books would certainly be ideal. :)

    File 490
    Code:
    ./FILE (Some type of header/Identifier)
    ./Alice_s_Adventures_in_Wonderland.cts (Table of contents)
    ./Alice_s_Adventures_in_Wonderland_00.bd (Book Data)
    ./Alice_s_Adventures_in_Wonderland_20_01.bin (compressed Narc file containing a picture)
    ./Alice_s_Adventures_in_Wonderland_footnote_00.bd (Book Data)
    
    ./Alice_s_Adventures_in_Wonderland/Alice_s_Adventures_in_Wonderland.NCGR/NCLR/NSCR (Graphic/Palatte/??)
    ./honzus/book/author/(Contains .bd .npix, .lpix)
    /honzus/book/novelist/ (picture of the author)
    /honzus/book/outline/(Contains .bd .npix, .lpix)
    /honzus/book/footnote/(Contains .npix, .lpix - bd was in root folder...)
    /honzus/book/main/(Contains .prf .npix, .lpix)
    
    So not much to it at least.
     
  5. Keshire
    OP

    Member Keshire GBAtemp Regular

    Joined:
    Sep 8, 2007
    Messages:
    145
    Country:
    United States
    Table of Contents file (.CST)
    Code:
    typedef struct Contents_1{
    //Not sure why there's two sets here, might have something to do with large/small font.
    ulong	unk[2]; //Offsets maybe?
    ushort	stringLength[2]; //String Length
    }Contents_1;
    
    typedef struct Contents{
    //Table of Contents
    ulong		Sections;	
    Contents_1	IndexSize[Sections];
    //Index of strings, string length comes from above array
    }Contents;
    
    What I'm assuming is the Identification File. It's the first file in the main archive. It's not a Narc file and it's not compressed.
    Code:
    typedef struct IdentFile{
    ulong        Unk;
    //Header
    ulong        Size0;    //Size of Header?
    ulong        Offset;    //Text Block offset
    ulong        Size1;    //Text Block Size
    ulong        Offset;    //Offset
    ulong        Size2;    //Size
    ulong        Offset;    //Offset
    ulong        Size3;    //Count
    
    ulong        Unk;
    ulong        Offset;
    ulong        Offset;
    ulong        Unk;
    
    //Data
    //ubyte        block[Size1];
    //ubyte        block[Size2];
    //ulong        block[Size3];
    
    }IdentFile;
    
     
  6. ferofax

    Member ferofax End of the World

    Joined:
    Jan 26, 2009
    Messages:
    2,564
    Location:
    Philippines
    Country:
    Philippines
    how fares the attempt? i'm interested in this progress. i really adored the polish on this thing, so a book injector would be awesome...
     
  7. Keshire
    OP

    Member Keshire GBAtemp Regular

    Joined:
    Sep 8, 2007
    Messages:
    145
    Country:
    United States
    Could use someone with some coding experience to help out with this. I'm not much of a coder unfortunately. I'm just decent with a hex editor and figuring out how files work.
     

Share This Page