For myself I spliced the save into 3 parts: save A, save B, and then the reset of the save. To get a grasp of the situation I spliced both saves into their 14 data blocks. Then I checked the save index of each of the 14 block to see if they were all the same. Save A had 10 matching blocks that had the same save index and Save B had 12 matching blocks that had the same save index. Meaning that save A had 4 blocks that was a duplicate of an existing block in the save and save B had 2 blocks that was a duplicate in the save. For either of the saves to be valid the save will need all 14 blocks and not missing any section ID numbers from 0-13. Do note the blocks are not aways 0-13 and rotate each time you save. So after the first time you save the block order will be 13, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 but all must be present in a rotating numerical order. In your case you were lucky as blocks 0-4 were intact which include trainer info, team/items, game state, misc data, and rival info. If any of those blocks were missing that block would have to be provided from a doner save and you would have to use PKHeX to modify the data to match what you had before. In addition you PC box A was intact with the rest of them being empty. So then I stitch save A back together in numerical order 0-13 to make sure I didn't miss anything and the missing blocks were just PC boxes which I duplicated one of you empty boxes to fill out the save. After that I made sure all the section IDs were in the correct order and updated the section IDs of the added box blocks so all 14 sections were present. Then I placed the save into the save A spot and duplicated it into the save B spot that way both saves were valid and then stitch on the rest of the save that I spliced off. Afterwards I opened it in PKHeX to make sure it loaded and used it to export the save to update the checksums. Then loaded the save on an emulator to make sure it was good to go. For the record this is the first time I did a fix where I had to fix the save blocks so I was learning while I was doing this. All of these steps can be condensed and made more simple.
Edit - Use this to help understand how the save is structured. https://bulbapedia.bulbagarden.net/wiki/Save_data_structure_(Generation_III)