The code for PCSRuns, EggMoveRuns, and PlmRuns was starting to look very similar. So I added the IStreamRun interface, to make adding new streams to the text tool easier in the future. This required giving PCSRun access to the model, which other streams already had.
Slight refactor: new string.Split variant. Got tired of all the code duplication / verbosity.
* allow the egg move limiter to be even more wrong (has to be within a given range, but doesn't have to point to FFFF)
* have pokenames and pokestats negotiate for a reasonable length, instead of pokenames always winning
* once a text table reaches length 100, allow for junk data in the bytes after the string closing FF.
* code quality improvements
* fix a crash when backspacing egg formats
* fix a crash when backspacing all the way to empty
* fix data corruption when edit-exiting multi-byte formats
*
* Instead of bailing out of text tables as soon as we catch an element that starts with a space, just trim off any elements that start with a space after another fail condition. This lets us find the Fairy type, even after a number of " " types.
* only do 'text must end in FF or 00' checks if it's a purely text table. For mixed tables, this restriction is less required.
* if an egg stream has the same pokemon or move listed twice in a row, that's dumb. Recognize that as _not_ what we're looking for.
* relax egg move compatibility: allow more than 2 pointers to it
* more strict when finding pcs tables
- some fan games include new versions of tables, but leave the old tables where they were with nothing pointing to it. Before we used the new anchor to tell where a table ended. Lacking that anchor, we can determine that the new text is part of the NEXT table and not the CURRENT table using a huristic.
- if the additional element appears to be text, but the _next_ element would start with a space, then the additional element might be a different width.
- if the extra spaces after the additional element are only enough to get 4-byte aligned, then the additional element is in this table, but is the last element. The spaces are just for word alignment.
* require that abilitynames's first pointer lives somewhere in the first 0x100000 bytes. This prevents us from finding false-positive pointers much later in the ROM, even if the data has been moved. (Note that FR, LG, and Emerald all have this pointer within the first few pages of data, while Ruby/Sapphire have it much later.)
* require that trainerclassnames have more than one thing pointing to them. This reduces false positives, even given our relaxed PCS Table searching logic.
Altair messes this up, because in that fangame, the egg moves were edited but the limiter wasn't. So the two lengths don't match, and the egg-moves were filled with "00 00".
To support other ROMs with this kind of problem, accept early exits from the format searcher.
The Egg Move stream has 2 types of data in it, each of which is 2 bytes long. Either it's a pokemon, or it's a move. (There's also the end, FF FF). This is the initial test to show that we can read an egg move stream from a format.
* Don't offer table tool in context menu of loose text
* Yield buttons for IContextItems with commands
* Ctrl+Click on pointer out of range returns an error
* Auto-moving a parent table that's being extended notifies about the move.