Menu

#669 MD5 of loaded iNES file

General
open
nobody
5
2014-08-27
2014-08-26
No

For various reasons (e.g., game-integrity checks) it'd be nice to provide some sort of hash of all of the data that FCEUX loads from disk. Currently, FCEUX only provides CRC/MD5 info for specific components (e.g., ROM-only <= missing VROM).

Attached is my patch to provide such a LUA function: rom.gethash("md5:file"). It's the MD5 of all of the data read in by iNESLoad(...).

With this patch, programmers can more easily identify games in their scripts and write game-specific or even dump-specific code.

E.g. on Ubuntu, I can do:

user@machine:/blah$ md5sum /path/to/game.nes
87f93e3f88563bcf4355ef1384a00521 /path/to/game.nes

user@machine:/blah$ echo 'if (md5hash() ~= "87f93e3f88563bcf4355ef1384a00521") then
print "Unsupported!"
end' > script.lua
fceux --loadlua script.lua /path/to/game.nes

1 Attachments

Discussion

  • zeromus

    zeromus - 2014-08-26

    it's fine if you want that, however, as far as i know, fceux's rom hashing is the same as every other emulator, which should be the roms+vroms concatenated as it would be stored in a iNES file. do you have some roms which are being hashed incorrectly?

     
  • Ryan W. Moore

    Ryan W. Moore - 2014-08-27

    I'm not aware of anything being hashed incorrectly. I just thought it'd be useful to let scripts hash other information (e.g., headers, trainer) so that scripts can target a specific dump. Those other pieces, in theory, could affect gameplay/emulation.

    If you don't want to incorporate the patch, that's fine. I wrote it for my own purposes and am contributing it back. :)

     
  • zeromus

    zeromus - 2014-08-27

    specific dumps could be targeted using the normal hash, but youre right about the trainers. I guess i can see why you would want it all.

     

Log in to post a comment.