How to find out the data type of a binary file

1

One problem I often face is figuring out what kind of data to use to store the contents of a binary file. For example, when I start a simpler emulator project like CHIP8 or Gameboy, I usually use a 8-bit value data type as unsigned char or std::uint8_t because I know the games of that time were usually 8- Bits.

But when it comes to a more "recent" console such as a Nitendo 64? This is more complex because of what I've researched, there are several types of ROMs of this format with different data such as Big Endians and Low Endians, so how can I find out which type is most suitable for storing these ROMs or any other ROM of any other console?

    
asked by anonymous 29.05.2018 / 13:50

2 answers

1

Generally, header format has no way, either you know it, or you discover it by trial and error.

And responding to your comment, you can store variables as you wish ... this will all depend on how you are implementing your emulator. The key point is if you are getting the correct information from the header. Once collected, store as necessary / pertinent.

The interesting thing is that you always store in an efficient way so that you do not have memory overhead, and in addition, matching the variable sizes may facilitate the development of the emulator, since the size of the emulator's system beating with that of the device can make it easier to "navigate" the ROM and / or the emulator kernel.

    
04.06.2018 / 18:58
1

This can vary greatly. There is no standard. Each image file has a different layout and this will depend a lot on each platform / architecture, see:

SEGA / Genesis : link

NES : link

    
29.05.2018 / 16:26