There has been more work in terms of legitimacy checks! The first check was to go through and make a list in the code of each Pokemon with only one possible ability in generation 3 as opposed to two abilities. This was an issue as if I randomly assigned a Mew for instance to have its second ability, it would then have no ability instead of defaulting to its first ability.
The other major thing to verify was the met location for each Pokemon migrated in. I would need to assign legitimate met locations for each Pokemon possible to migrate in, or each of all 251 Pokemon available in generations 1 and 2. That would be a lot of work. Instead, I assigned them all as if they were hatched, which makes no difference in the visuals anyways as the actual met location is only displayed if the player checking location is the Pokemon’s original trainer. The exception to this is legendaries and Unown (as they can’t breed).
While thinking about how to handle this, I made the discovery that the generation 3 games use game origin markers from ID 0-15, but only 6 of these are used. For Ruby, Sapphire, Emerald, FireRed, LeafGreen, and Colosseum/Gale of Darkness (those last two use the same ID). Coincidentally, HeartGold and SoulSilver are identified using different IDs within that same 0-15 range. After doing some testing, I realized that I could set the flag for them to have originated from HGSS and that flag is maintained through Pal Park, all the way through up to Pokemon HOME without issue, and still showing the origin of Johto in Pokemon HOME. This made the origin game issue very easy, as I could assign the proper region for each Pokemon as it is migrated through without any issues regarding legitimacy. But I would still need to sort out legendaries and Unown if levels don’t match, as well as mythical distributions.
Mythicals obtained via distribution get more complicated as OT, OT ID, met location, and met level all need to be accurate to pass legitimacy checks. Luckily, there are only 2 mythical Pokemon to be migrated in so it shouldn’t be too much of an obstacle, OT just may not match as it was in generation 1 and 2 as it would need to be updated to retain legitimacy.
The last issue regarding legitimacy I have encountered so far is changes in movesets. There are multiple Pokemon that cannot legitimately learn specific moves in generation 3 that they could in generation 1 and 2. Due to the amount of data I would need to store to check this, I will likely leave this untouched, and anyone moving Pokemon further forward would simply need to take the Pokemon to the move deleter or replace the move my learning a new one to then make it legitimate once more. I will do some testing to verify what stage in the migration it will stop these Pokemon and whether deleting the move at the last possible stage mitigates the issue or if it is still determined to be illegitimate.
After I resolve the issue with legendaries/mythicals and do some further testing regarding movesets, I should be ready to start testing on real hardware! There will likely be issues when moving the code over to the Arduino, but hopefully it is without any further major rewrites.