Commit Graph

50 Commits

Author SHA1 Message Date
Benjamin Popp
0969aa11f4 Update table names abilitynames and trainerclassnames
abilitynames -> data.abilities.names
trainerclassnames -> data.trainers.classes.names
2020-07-13 08:11:09 -05:00
Benjamin Popp
2c65d4743d rename movenames -> data.moves.names 2020-07-13 08:01:14 -05:00
Benjamin Popp
23bfa77890 rename pokenames -> data.pokemon.names 2020-07-13 07:47:10 -05:00
Benjamin Popp
ffe37fa9f4 Fix failing test
Also use automated code review
2020-05-27 23:28:39 -05:00
Benjamin Popp
9995e60fa4 Add filter-by-type criteria 2020-05-07 11:18:44 -05:00
Benjamin Popp
2f79e0252d Decode movement data correctly for FR/LG
the movement enum is different between FR/LG and R/S/E.
To support this, add default.*.toml files which include extra defaults specific to one or more games. Right now, only a single list is there. But this feature should allow for more interesting game-specific defaults in the future.
2020-04-21 21:38:42 -05:00
Benjamin Popp
b79d7a6ea1 Allow inline script editing 2020-04-20 11:18:42 -05:00
Benjamin Popp
cf0c73691f Auto Format 2020-04-06 22:58:51 -05:00
Benjamin Popp
cac1c8f9bb Bugfixing
For some roms, the sprites load at the wrong length. When the proper length is later discovered, it's important to update the length of all related tables, not just the current table.

* Emerald had the wrong pointers/length for trainer sprites
2020-04-04 15:08:53 -05:00
Benjamin Popp
9a14a78f82 Allow more types of runs in tableReference.txt
Instead of keeping tables segregated from other kinds of runs that we want found automatically, just allow all types of runs in the tables file.

Combine the typechart runs into a single run, which makes the chart easier to work with.
2020-03-31 15:21:54 -05:00
Benjamin Popp
a6bbbe48ee Auto Format
also remove a redundant cast
2020-02-17 21:59:24 -06:00
Benjamin Popp
3e8fd018a1 Refactor Singletons
Previously, the creating a new ViewPort loaded from 2 text files and creating a new HardcodeTablesMoel loaded from 1 text file. This is a lot of parsing!

Refactor to do the parsing once, in the EditorViewModel, using a Singleton class to hold the non-editable loaded data. Inject that data into the appropriate structers later on.

To prevent massive refactoring in the tests, not every ViewPort needs to be given a Singletons instance. Instead, allow a ViewPort to still do its own parsing. However, BaseViewModelTestClass has been updated to make this work for a majority of tests, along with changes to AutoSearchTests's fixture and several of the Setup methods that are used by multiple tests.
2020-02-08 21:25:48 -06:00
Benjamin Popp
bfe24f6dcb Enable loading weird files that look like the actual roms 2020-02-04 21:10:20 -06:00
Benjamin Popp
ee24e401d0 Refactor
- Remove AutoSearchModel. We're not using it anymore. Move its constants to HardcodeTablesModel.
- Move constants from EggMoveRun to HardcodeTablesModel. Should've done this a while ago.
2020-01-18 22:31:01 -06:00
Benjamin Popp
0fe3b3d7c0 Bugfix: load default.toml correctly 2020-01-13 22:03:44 -06:00
Benjamin Popp
dc28c0890f Offload standard anchors / lists to a default toml file
Once again, make things more data-driven to reduce the code. Having a default.toml file makes it easier to add to or change the defaults.
2020-01-13 21:47:14 -06:00
Benjamin Popp
7258ddaf8e Condense known tables into a reference file
Other things should probably be in this reference file too, such as the headers, streams, and default lists. But this is a good start and should make it more expandable in the future.
2020-01-12 21:13:22 -06:00
Benjamin Popp
6cc97c2288 Support Ruby / Sapphire 1.1 2020-01-11 22:50:47 -06:00
Benjamin Popp
9aef5f124d Support FireRed / LeafGreen 1.1
Adding all the table locations for FR/LG 1.1
2020-01-05 19:48:56 -06:00
Benjamin Popp
2c0b01894f Refactor to be able to support the 1.1 versions
Each of Ruby/Sapphire/FireRed/LeafGreen has a 1.1 version as well as the 1.0 version floating around online of the English GBA rom. I should be able to tell the difference between the two versions and load tables correctly.

This refactor makes it possible to tell the difference. Loading the tables correctly is coming next.
2020-01-04 20:10:19 -06:00
Benjamin Popp
d1ba8e2a27 Implement search for branch-link
in thumb code, branch-link commands are relative. That means that the instruction for the same destination will look different depending on the source.

As a user, I want to know what thumb code calls a routine I'm looking at. That's most likely going to be via a branch-link command, although it could be through a blx. Let the user use Find -> "bl <someaddress>" to search for branch-links that jump to a given location.
2019-12-15 14:45:01 -06:00
Benjamin Popp
a38e81347d Add List for Evolution Methods 2019-12-14 21:54:04 -06:00
Benjamin Popp
8d292d2ab7 First Pass List Support
* Added some default lists
* Lists are loaded/saved with the TOML file
* Tests showing that lists work right.

Lists can be used as text displays for enums/bit arrays. The difference is that lists aren't sourced from the ROM.
2019-12-14 21:31:13 -06:00
Benjamin Popp
50c252cb6f MakeTutorsExpandable updates tutor special (in FR/LG)
In FR/LG, there's a limiter built into special 397 (the move tutor special) that makes it behave differently after the element 14 (0-14 act one way, 15+ act a different way). I added a one-byte change to switch the branch condition to 'never'.

In order to do this, I needed to locate the special list, so I went ahead and added it to all the games, complete with a unit test to verify.

The specials table + Clover exposed a bug: when adding anchors from a table with an unknown pointer format, we need to clear the data of existing conflicting runs. Example: a text run that goes over the anchor isn't actually a text run.
2019-12-12 20:58:56 -06:00
Benjamin Popp
1da35195d3 add support for type chart
this is the first top level custom stream, so there was some extra places where I needed to add cache scopes. Otherwise, this is a fairly straightforward change.
2019-12-05 23:20:33 -06:00
Benjamin Popp
c6d97f84e5 Improve child verification logic for table streams
The TableStreamRun/LengthFromParentStreamStrategy/GetCount has trouble getting the Count correctly during the initial verification, since the parent table hasn't actually been added to the model yet. So GetCount needs access to both the parent table's segments and the name of the pointer field. This lets the LengthFromParentStrategy to math to figure out segment offsets without needing the parent to actually be in the model. This extra info is only needed during verification: it's ok if it's `null` once the run is already added, such as during `CompleteEditOperation` and `TableTool`.

Add verification logic so we can know that we found a reasonable number of multichoice for each test rom. DarkRising's data is bugged, so ignore that one.
2019-12-05 21:47:34 -06:00
Benjamin Popp
3329c2f81c Bugfixing
The multichoice didn't load right for a number of reasons
* The PCS has a double-escape character that I wasn't handling right.
* The check to see if a value is correct should verify that the value doesn't look like a pointer (high-byte on a 4-byte value should be less than 0x08).
* Had the wrong source for FireRed: typo
* Inner formats weren't being verified correctly for added tables
2019-12-02 18:15:18 -06:00
Benjamin Popp
d8b4d5e8c3 add multichoice table 2019-12-01 21:15:52 -06:00
Benjamin Popp
07a76c7409 Update wild table
wild table's pointers lead to streams with another pointer. Go deep!
2019-12-01 14:42:47 -06:00
Benjamin Popp
79deb09532 Allow table stream pointers to add new anchors 2019-12-01 14:23:27 -06:00
Benjamin Popp
81e5efb4cf find wild data top level
top level wild data is found correctly
2019-11-30 21:24:58 -06:00
Benjamin Popp
3bf8e0ddc2 Update default items format
hold effect is 1 byte long, then there's another parameter byte used to distinguish the effects of Potion / Super Potion, or Berry Juice / Oran Berry.
2019-11-30 15:30:08 -06:00
Benjamin Popp
1f8428c810 Autoformat 2019-11-24 14:41:05 -06:00
Benjamin Popp
ee38a7b080 Add Dex Tables
There are 4 tables related to the pokedex that I'm adding here:
* regional dex: for each pokemon, what is its regional dex index
* national dex: for each pokemon, what is its national dex index
* conversion: for each regional dex entry, what index is it in the national dex (can be computed automatically, so I added a QuickEdit item)
* dex info, such as the dex description

I also updated App.xaml and MainWindow.xaml.cs to make the QuickEditItems look better.
2019-11-24 14:39:17 -06:00
Benjamin Popp
f976c02417 Include decorations table
Not really much to say here. Added format for new table, added test for new table, done. Probably the most straightforward addition I've done so far.
2019-11-23 15:39:43 -06:00
Benjamin Popp
f401323dd8 Support for evolution table
* table format feature: allow for recursive table definitions, simply because it's shorter.
* include expected locations of pointers to the Evolution table
* unit tests to show that we found the evolution table correctly
* model bugfix: when specifying to keep pointers, don't clear them during unusual loading situations
* model bugfix: when adding a format to a pointer in a table, if that location is already a table, give up and leave the table there.
2019-11-22 22:56:29 -06:00
Benjamin Popp
3895eb2370 Add Move Descriptions table
The first move has no move description. So the move desciptions table should be the same length as the move names table, minus one. Added support for this kind of concept.
2019-11-22 14:39:38 -06:00
Benjamin Popp
e4156c418d Better change tracking implementation & UI
change tracking was previously done in the model, but exposed in the ViewModel via a data format. The problem with this is that it meant that all changed formats were wrapped in a new format, which would require a lot of work to fully validate.

The new implementation is still in the model, but exposed in the ViewModel through a new property on the HexElement. The data formats are unchanged.
2019-11-06 12:36:26 -06:00
Benjamin Popp
d878c2ae9d Refactoring to make it possible to show edited cells 2019-11-05 22:11:24 -06:00
Benjamin Popp
f148e8a7fe Refactor: make trainer teams work with new table features
Trainer teams are also a stream run. Add support for searching for them into the table tool.
2019-11-05 12:08:02 -06:00
Benjamin Popp
aec0c5a57e Merge branch 'trainer-pokemon-teams' into usability-updates-3-2 2019-11-05 11:10:49 -06:00
Benjamin Popp
d13613f431 Improve lvlMoves member name
This name appears in the table tool. Make it more helpful.
2019-11-02 22:15:24 -05:00
Benjamin Popp
b8d2dc4645 Trainer Pokemon Team Support
Well it's not pretty and it's not well tested, but the first phase of trainer pokemon teams is complete!
The trainer pokemon team (TPT) is both a table and a stream: it's a table of pokemon, but it's also editable as a stream. This lets me show a trainer's pokemon as part of the same table as the trainer, but you can dive down for table support.
2019-11-01 13:44:59 -05:00
Benjamin Popp
2900e252f9 Allow tables to include integer-bounded fields
Integer bounded fields work a lot like table-matched fields. But instead of having an option of every entry in the table, it's just an option of every entry less than the given number.

* Also moved `GetOptions` to `ModelCacheScope` since no one else is using it.
* Also updated `ArrayRunEnumSegment` to use cache scopes.
* trainerdata makes use of this feature
2019-10-28 15:04:03 -05:00
Benjamin Popp
ecc0ceee33 Tutor fix
tutor compatibility was finding the wrong data.
2019-10-28 08:33:50 -05:00
Benjamin Popp
0c55136f2a add basic trainer support
Trainer tables include a nested pointer, which works a bit weird because the pointer points to a different data structure depending on the `structType`. The structure is a table, but won't be named. Since that pointer will require some more changes, for now we're just adding the parent table - the trainers.
2019-10-27 21:24:53 -05:00
Benjamin Popp
6827faa013 Add links into table tool
To facilitate faster editing, the table tool enums and bitarrays now include links to their sources. This should allow the user to jump to a source faster for when they want to add a new option to a list, such as adding a new type or a new item.
2019-10-21 22:45:20 -05:00
Benjamin Popp
71485d0743 Fixing more tests
everything is working at this point except Gaia
2019-10-19 19:44:08 -05:00
Benjamin Popp
42b3d4349e Hardcoded Tables improvements
It now works for all existing tables with all 5 base roms.
2019-10-19 13:29:32 -05:00
Benjamin Popp
18c714e4cc hard-code stage 1
The AutoSearchModel is nifty, but seems to have trouble in a lot of situations where data isn't in the format I expect.

However, I've noticed that while many romhacks move tables around, a lot less of them move code around. So I can depend on most of the pointers to those tables still being in the same spot.

Based on this idea, I've created a new "HardcodeTablesModel" that uses known pointer locations to find tables instead of just searching for tables based on their format. This lets me simplify a lot of the logic, reducing it to basically a pointer lookup in many cases.

Most of the tests for FireRed are passing now using the new HardcodeTablesModel. I'll continue looking into issues from FireRed and the other baseroms in the next update.
2019-10-18 23:03:48 -05:00