How to find the data type of a binary file

Asked

Viewed 74 times

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 an 8-bit data type like unsigned char or std::uint8_t because I know that the games of that time were generally 8-Bits.

But when it comes to a more "recent" console for example a Nitendo 64? This one is more complex because as far as I’ve researched, there are several types of Roms of this format with different data like Big Endians and Low Endians, so how can I find out which is the most suitable type to store these ROM or any other ROM from any other console?

2 answers

1


Generic way, header format is hopeless, or you know it, or you find out by trial and error.

And responding to your comment, you can store variables however you want... it all depends on how you are implementing your emulator. The key point is whether you are getting the correct header information. Once collected, store as necessary/pertinent.

The interesting thing is that you always store efficiently so as not to have overhead of memory and besides, matching the sizes of the variables can be that it facilitates the development of the emulator once the sizes of the emulator system beating with that of the device can facilitate "browse" in the ROM and/or "kernel" of the emulator.

1

  • I researched a little more about N64 headers and saw that what usually changes is the order of bytes (something I will have to study to better understand), in case, the types of data can cause difference in reading? For example, if I store a Gameboy ROM in a 64-bit type (or vice versa), it could occur to read a data incorrectly?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.