melonDS-emu / melonDS

DS emulator, sorta
https://melonds.kuribo64.net
GNU General Public License v3.0
2.98k stars 493 forks source link

Fix various issues with firmware generation #2058

Open CasualPokePlayer opened 3 weeks ago

CasualPokePlayer commented 3 weeks ago
  1. Various spots left generated structures with uninit data, leaving to garbage placed in generated firmware.
  2. Firmware(const u8* data, u32 length) ctor was susceptible to a buffer overflow or garbage being left in the buffer since FixFirmwareLength may change the resulting buffer size (although the input buffer size is still the same).
  3. GetEffectiveUserData would use userdata 1 instead of 0 if the update counters were equal (which notably would be the case always with generated firmware). Firmware bootup and games would use userdata 0 however if they were equal. This lead to firmware override not working sometimes. Fixing this resolves #2057.