d0k3 / Decrypt9WIP

Multipurpose content dumper and decryptor for the Nintendo 3DS
GNU General Public License v2.0
405 stars 59 forks source link

Flaky NTR cartridge connection can lead to nonsensical dump #129

Closed izzy84075 closed 7 years ago

izzy84075 commented 7 years ago

I was going through and dumping my DS cartridges tonight, and one of my cartridges' contacts are pretty heavily worn. It took a couple tries to get it to be recognized as "valid", but the dumping parameters didn't make any sense. It said that the "Cartridge data size" was 0MB, but the "Cartridge used size" was 1558MB, and so the "Cartridge dump size" was also 1558MB.

A sanity check that the cartridge used size is less than the data size might be good.

izzy84075 commented 7 years ago

CTR cartridges already have this kind of check: https://github.com/d0k3/Decrypt9WIP/blob/master/source/decryptor/game.c#L1957 .

NTR/TWL cartridges don't. https://github.com/d0k3/Decrypt9WIP/blob/master/source/decryptor/game.c#L2160 (Should be somewhere right around there, probably, if it existed.)

d0k3 commented 7 years ago

Okay, fixed by your own pull request, thank you!