tewtal / SMZ3Randomizer

Super Metroid & A Link to the Past Crossover Item Randomizer V11
https://samus.link/
MIT License
75 stars 31 forks source link

Added rom checksum fix #126

Closed SmolBig closed 3 years ago

SmolBig commented 3 years ago

Added functions to WebRandomizer/ClientApp/src/file/rom.js which calculate and apply a corrected checksum for the rom data. Added an invocation at the end of prepareRom().

This should work for SM and SMZ3, but I've only just got the SMZ3 web gen working and still don't know how to launch the SM page, so I was not able to test it for SM.

Note that the fixupChecksum() function assumes that the ROM will be either SMZ3(6MB) or SM(3MB) and won't calculate the correct sum for other ROM sizes. If the size of either ROM is changed then the algorithm used should be updated accordingly (see link in code comment), but won't cause any issue other than incorrect sums if it's ignored.

RebelusQuo commented 3 years ago

First question: Is this something we even care about? Perhaps the checksum was updated in v10 and prior due to being forked from Z3r, and the php did it? It's not in the v11 port, but should it eventually be in "our" code as well? @tewtal, please advice.

Second question: Have you seen http://acmlm.kafuka.org/board/thread.php?id=5013 (or similar source)? that algorithm seem to be size agnostic, which would be a better solution. Point in case, the SM rando seeds are not 3 mb, they are 4 mb in order to host the custom player sprite implementation. I mentioned this in the first point in the PR message for #116.