I'd like to learn how to analyze files

Discussion in 'Wii U - Hacking & Backup Loaders' started by Pikachuk, Feb 21, 2017.

  1. Pikachuk
    OP

    Pikachuk GBAtemp Advanced Fan

    Member
    642
    146
    Mar 19, 2016
    France
    Bordeaux
    Hello, i'm currently interested by the research of new ways to modify files and things like this but i don't find documentation to learn how to analyze files on hex editor to recognize header/ blank parts (all the parts) and how to modify from the informations obtained
    I'm really interested even if it requires work, i'd just like to find documentation to learn
     
  2. VinsCool

    VinsCool Insecure

    Member
    GBAtemp Patron
    VinsCool is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    11,495
    26,864
    Jan 7, 2014
    Canada
    Another World
    Peek and poke. That's how I learnt.
     
  3. BullyWiiPlaza

    BullyWiiPlaza Nintendo Hacking <3

    Member
    1,666
    1,370
    Aug 2, 2014
    Germany
    It depends and you can't really know anything without some kind of documentation...
     
    VinsCool likes this.
  4. Pikachuk
    OP

    Pikachuk GBAtemp Advanced Fan

    Member
    642
    146
    Mar 19, 2016
    France
    Bordeaux
    Yes that's why i'm searching basic documentation that would help to recognize different parts of files
    I know the basics of C# i would just have to learn the rest to create tools but to create tools i've need to understand the structure of the files i want to modify
     
  5. Arck

    Arck GBAtemp Advanced Fan

    Member
    669
    300
    Mar 13, 2016
    You have a lot of open source file editor....

    Why not looking at them ?
     
    VinsCool and Mega-Mew like this.
  6. Hikari06

    Hikari06 GBAtemp Advanced Fan

    Member
    815
    578
    Nov 20, 2012
    France
    Nice
    There is no magical way, each format is different.
    Either you have a proper documentation with offsets and all and that's just a matter a properly parsing it.
    Otherwise you have to r.e the structure yourself. Usually it's done by comparing several versions of the file with one or more variables which you know. Depending on the complexity of the format it may be very easy or quite hard if you have to deal with compression, checksums etc...
     
    Last edited by Hikari06, Feb 21, 2017
  7. FAST6191

    FAST6191 Techromancer

    pip Reporter
    23,168
    8,907
    Nov 21, 2005
    It might be better to look at a more documented system, like the DS, but if the wii u is what will retain your interest it is not so bad.

    Even without that there are loads of people that pulled apart file formats before, some of it might not apply to your systems (though things rarely go completely out of fashion) but more info in your head is not a bad thing.
    http://wiki.xentax.com/index.php/Game_File_Format_Central
    https://wiki.multimedia.cx/index.php?title=Category:Game_Formats

    In my case there are three things I would look at

    1) Pointers. They are something of a boogeyman for C family programmers, and most courses don't teach them in the best way. They do much like they say though and indicate the location of something within a file or memory. Sometimes they will start counting from the start of the file, sometimes it will be a little way in (usually from the end of the given section or start of the one you want), sometimes they will be relative (take the location you are at and add the data from the pointer) and sometimes they will have some kind of crazy maths done to it (a few times I have had pointer contents need to be shifted to display the proper data)
    2) The hardware. Hardware is rather limited and only displays things in certain formats and converting on the fly is a pain. To that end many formats will mirror the hardware they are going to go into at some level, or at the very least play to it -- if your system does 16 bit reads especially well you might well have a format aligned to 16 bits rather than everything packed end to end. I don't know what I can point you at for a summary of wii u hardware, however it is very similar to the wii and gamecube so it can be worth learning what goes there
    http://wiibrew.org/wiki/Main_Page
    http://hitmen.c02.at/files/yagcd/yagcd/frames.html
    3) High level formats. Despite what I said above about hardware there are many that will use known, be it in general world or in game specifically (or in whatever other field you are using), formats for their things as said formats may well have existing conversion code, and have solved all the problems likely to come up which saves a lot of effort.

    I could go on and talk about text specifics, 2d graphics, 3d graphics, wave music, sample music, level designs, general game code, assembly and whatever else but I won't do it here, mainly as I have done it before with pictures and worked examples http://gbatemp.net/threads/gbatemp-rom-hacking-documentation-project-new-2016-edition-out.73394/
     
    VinsCool likes this.
  8. Pikachuk
    OP

    Pikachuk GBAtemp Advanced Fan

    Member
    642
    146
    Mar 19, 2016
    France
    Bordeaux
    I know, each file is special i don't search to have all the job done i search more something that could help me get started for example i'm not able to add bytes to a file without making it crashing and things like this
     
  9. Hikari06

    Hikari06 GBAtemp Advanced Fan

    Member
    815
    578
    Nov 20, 2012
    France
    Nice
    Well that's because you can't just append data to a file without knowing the structure first.
    I believe you really should start with easy file formats and try to understand how they work, then code a parser to handle them.
    For instance, try writing a tmd parser :https://3dbrew.org/wiki/Title_metadata.
    It's already been done but practice makes perfect as they say.
     
  10. Pikachuk
    OP

    Pikachuk GBAtemp Advanced Fan

    Member
    642
    146
    Mar 19, 2016
    France
    Bordeaux
    Actually the problem is that i'm really level 0 for example, terms like chunk and things like that are unknown for me
     
  11. Hikari06

    Hikari06 GBAtemp Advanced Fan

    Member
    815
    578
    Nov 20, 2012
    France
    Nice
    Maybe you should start by reading those articles which introduce basic concepts :

    https://fr.wikipedia.org/wiki/Endianness
    https://fr.wikipedia.org/wiki/Alignement_en_mémoire
    https://fr.wikipedia.org/wiki/Remplissage_(cryptographie)
    https://fr.wikipedia.org/wiki/Somme_de_contrôle
    https://fr.wikipedia.org/wiki/Système_hexadécimal
    https://fr.wikipedia.org/wiki/Cryptographie_symétrique
    https://fr.wikipedia.org/wiki/Cryptographie_asymétrique
     
    Last edited by Hikari06, Feb 21, 2017
    VinsCool likes this.
  12. Pikachuk
    OP

    Pikachuk GBAtemp Advanced Fan

    Member
    642
    146
    Mar 19, 2016
    France
    Bordeaux
    Thanks for the links it's really useful

    — Posts automatically merged - Please don't double post! —

    Thank you too
     
    Hikari06 likes this.