Commit Graph

700 Commits

Author SHA1 Message Date
Benjamin Popp
ae2947087b Clip leading 0x off gotos 2020-03-27 10:31:06 -05:00
Benjamin Popp
c25cac9811 Merge branch 'master' of https://github.com/haven1433/HexManiacAdvance 2020-03-21 22:39:06 -05:00
haven1433
31c2fec638
Merge pull request #66 from haven1433/version-in-toml
Store the version in the metadata TOML file
2020-03-21 22:38:21 -05:00
Benjamin Popp
c8ea6b2585 Add mapnames support
This list appears to be a list of names for the areas. Not sure if it's connected to the overworld map, travel map, or something else. But it seems to be the only place where all the town/route names are stored in a single list.
2020-03-20 22:18:50 -05:00
Benjamin Popp
e8c9746de7 Version Bump 2020-03-19 08:46:37 -05:00
Benjamin Popp
e2e15ad388 Fix possible crash
If asked to FindPossibleTextStartingPlaces before the rom starts or after it ends, just return empty
2020-03-19 08:46:08 -05:00
Benjamin Popp
3051b64a01 Reset Horizontal Scroll when the Scroll Bar disappears
Previous bug:
* Go to some wide data (like trainerdata)
* Scroll all the way to the right
* Do a pointer jump
* Scrollbar is gone, but data-clicking still thinks you're scrolled.
2020-03-19 07:53:55 -05:00
Benjamin Popp
41442fa63f Update the table tool address after text edits 2020-03-18 22:28:08 -05:00
Benjamin Popp
3622cd733d tutormoves -> typing in firepunch resolves to ”PSYCHO BOOST”
fixed the bug
2020-03-18 22:08:22 -05:00
Benjamin Popp
c55445c9d1 Store the version in the metadata TOML file
This allows us to detect what version of the app was used to last save changes to this file, which lets us detect when the user has upgraded HMA and is now using it on a file last touched with an older version.

For example, we could notice that there were new auto-tables added since the last version, and the user might want us to add them.
2020-03-03 16:21:29 -06:00
Benjamin Popp
84b21109e5 Stop trying to list every table on the start screen
At this point, the start screen has become just a wall of text that no one reads. If I simplify it and only expose the tables people would most likely want to edit, it's more likely to be helpful for beginners.
2020-02-21 20:25:31 -06:00
Benjamin Popp
f1e13a52b6 Don't crash when the user hits backspace on a bitarray 2020-02-21 20:17:27 -06:00
Benjamin Popp
6a77654a4f Rename CompleteEditOperation -> CompleteCellEdit
This is to match `StartCellEdit` and `ContinueCellEdit`
2020-02-21 19:43:30 -06:00
Benjamin Popp
c84ca39285 Make utility methods for ModelCacheScope to make it less verbose
also move some helper methods to keep all the visitor code organized
2020-02-21 19:41:18 -06:00
Benjamin Popp
f631b31c6e Better bitfield editing support
With this change, you can now type a name of a bit into a bitfield to turn it on, and type a lone dash '-' to clear the bitfield. This makes it possible to have paste-scripts know the names of the moves they want to set, and then set them. For example:

`@tutormoves/bulbasaur - "mega kick" "solar beam" "grass knot"

The dash clears the bitfield, and then typing the names sets those bits.
2020-02-21 19:23:24 -06:00
Benjamin Popp
e146392e50 Only use a partial match if no full match is found
This fixes the bug where typing 'repel' would autocomplete to 'repeat ball'
2020-02-20 21:03:36 -06:00
Benjamin Popp
4d47333f82 Find table for pickup's items. Also add table for battle scripting commands
The battle scripting commands are each an assembly routine that specifies what a specific battle script command does. Right now these are just raw pointers, but I have a feeling I'm going to want these in the future...

Each game handles the pickup tables a little differently. R/S/FR/LG store an item and the odds of getting that item (cumulative). Emerald instead stores two tables, one for common items and one for rare items. What values are used from within those tables are based on the pokemon's level.
2020-02-20 20:50:37 -06:00
Benjamin Popp
32c0a80f6e Decrease brightness of edited cells
Edited cells need to be easy to see, but not garish
2020-02-17 22:21:50 -06:00
Benjamin Popp
da0fc4f4ab New table elements get sane initial values
When a table is expanded, instead of giving a new element a value based on whatever value is already there (usually FF), change the value so that the new element matches the previous element. This is likely not the value that the user wants, but it's a much better default than FF.
2020-02-17 22:15:30 -06:00
Benjamin Popp
a6bbbe48ee Auto Format
also remove a redundant cast
2020-02-17 21:59:24 -06:00
Benjamin Popp
19403787ba More space between tables when expanding
Since we do expansion one at a time, add mare space between tables so that expansion will move tables less often.
2020-02-17 21:57:45 -06:00
Benjamin Popp
cf35b313fa bugfix: ScrollFromRunMove should scroll better
When a run moves due to a table extension, we want to scroll to the same relative location in the newly moved data. The math for doing that was wrong.
2020-02-17 21:54:13 -06:00
Benjamin Popp
7228108bf5 Increasing child table lengths based on parent table expansion should repsect parent offset 2020-02-16 22:06:55 -06:00
Benjamin Popp
a35bab26b6 Table Tool Pointer Editing Improvements
Previously, any invalid values typed into a pointer field in the table tool would be overwitten immediately with correct data. This made it almost impossible to manually type a value that would eventually be valid, such as `<null>`. This is now corrected: if the user types a value that would be an error, the error value is left in the field and no change or notification is made to the model.
2020-02-13 21:29:23 -06:00
Benjamin Popp
2e6777e19f Refactor ArrayRun.TryParse to not throw for table streams
When parsing table-streams, we shouldn't rely on an exception in the ArrayRun constructor. We should avoid even calling the ArrayRun constructor. Save exceptions for cases that are exceptional.
2020-02-13 21:13:06 -06:00
Benjamin Popp
52a164c0ed Include Wiki Links for Quick Edits
Since every quick-edit item has documentation explaining what it does in detail, go ahead and link to them from the app.
2020-02-13 21:05:23 -06:00
Benjamin Popp
dfa24e0a84 Test Performance
Make the `ExpandableTutorsWorks` test run slightly faster by letting it re-use Singletons between multiple tests for multiple ViewModels. Since the Singletons are uneditable, this is safe.
2020-02-12 20:42:26 -06:00
Benjamin Popp
79aa2ff05d Bugfix
During a refactor, I lost this ToList. But I need this one, because this enumerable is used multiple times.
2020-02-12 20:41:24 -06:00
Benjamin Popp
1cd459a8dc Handle testing edge case
If there is no file name, you can't get a full path to the file name
2020-02-10 22:47:02 -06:00
Benjamin Popp
57aef9a826 Hover over tab for full name
For search tabs, it'll now only show the first few characters of the search in the tab, and the hover will show you the full search term.
2020-02-10 22:39:24 -06:00
Benjamin Popp
118a09db8b Improve theme update performance 2020-02-10 22:25:59 -06:00
Benjamin Popp
ad00a0cda6 Update Scrollbar value properly after Goto changes viewport width
ScrollRegion should notify width change _after_ updating scroll range.
ViewPort should notify UI that the ScrollValue has changed after the ScrollRegion.Width changes.
Animation should be skipped if the previous scroll value isn't known.
2020-02-10 22:24:06 -06:00
Benjamin Popp
09f2288621 Simplify how MoveExpansion works
update pp-pointers and code that uses them:
- search for the 5 pointers to the pp-data
- search for 42 00 12 18 92 00 (uses of a multiply by 12, the movedata width)
- find the nearest earlier use, and update to 0C 22 42 43 12 1D (*12+4)

update limiters:
- find uses of B1 20 40 00 81 42 (the limiter code)
- change the 00 to 02 (multiply by 512 instead of 2, MUCH higher limit)
2020-02-09 21:38:06 -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
e1bd0f539c Adjust how move expansion works
There are 5 pointers to the PP field in the movedata table. One of the goals of move-expansion is to simplify this by shifting these directly to the movedata table, so that repointing works automatically.
The 5 routines call only 2 subroutines using the PP field pointer, so my previous attempt changed those 2 subroutines. However, I failed to realize that (lots of) other code also calls these subroutines, so changing these subroutines has adverse side-effects. To correct this, I should change the 5 routines instead of the two subroutines.

This has been prototyped with FireRed and needs to be expanded to the other 8 roms.
2020-02-08 20:03:34 -06:00
Benjamin Popp
851da6880d Update code tool to allow it to write code
This is currently not a user-exposed feature, but it was very helpful while researching how to make the proper changes for move-expansion.

It shouldn't be exposed (CodeTool.IsReadOnly=false) until I figure out how to handle edge cases and compile error reporting better.
2020-02-06 21:42:49 -06:00
Benjamin Popp
109a48ebbe Merge branch 'master' into egg-crash 2020-02-04 21:10:52 -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
c850895e0b Move Expansion Bugfixes
The code didn't quite do what I meant for it to do. Fixed the broken offsets, fixed the broken code, and made the operation use the undo system.

The code still doesn't have the effect I expected, but at least it's now making the changes I expected.
2020-02-01 22:18:00 -06:00
Benjamin Popp
389886f4b5 Add tables for moveanimations / moveeffects
we're going to need to be able to automatically extend the moveanimations table when a new move is added
2020-02-01 15:26:38 -06:00
Benjamin Popp
46e816ed57 Introduce the MakeMovesExpandable Quick Edit Item
Also adds automated tests to show that the code works like I expect. Note that this hasn't been tested in the actual games yet.

Note that a version of QuickEditItemDecorator needs to be checked in to avoid a boot-strap issue, since QuickEditItemDecorator is needed in the same assembly as IQuickEditItem. I could alternatively do a double-build of only the interfaces to fix this, but that seems heavy-handed for now.
2020-01-31 20:34:53 -06:00
Benjamin Popp
df4b959e8e Refactor: fix name 2020-01-31 19:41:33 -06:00
Benjamin Popp
377f72a06b Improve lvlmoves auto-test
The test should fail if the run's elementcontent isn't `plm` data.
2020-01-28 22:08:15 -06:00
Benjamin Popp
45c409390f Improve SystemExtensions
`IsAny` should work for enums
2020-01-28 22:07:25 -06:00
Benjamin Popp
b37b453536 Allow pointer-to-text tables to be enum options
example: the natures table
2020-01-28 22:07:03 -06:00
Benjamin Popp
5b1cd760fe Auto-find natures table 2020-01-27 23:10:47 -06:00
Benjamin Popp
64bc82c1f3 Regression Fix: lvmoves use the plm format 2020-01-26 21:51:24 -06:00
Benjamin Popp
6a87a7b79b ClearFormat to prevent double-format issues when expanding bitsegments during initialization
When loading from a TOML file, the bitsegment might get created before the table that it's based on. If so, then the bitsegment (and thus the entire table) will need to be expanded. When that happens, we need to expand in-place, because the original format was too short to encompass the data.

When that happens, we need to clear away whatever format is already in that spot, because that format is known to be wrong.

Related change: do a ResolveConflicts step as soon as we finish loading the metadata, to make sure that the metadata-load didn't leave us in a bad state.
2020-01-23 22:03:30 -06:00
Benjamin Popp
cb90716f90 Version Bump 2020-01-22 22:06:16 -06:00
Benjamin Popp
c175495b7a TableTool is open by default
To help users understand the features of the program, go ahead and have the table tool open by default. This has the benifit of showing a drop-down list with all the current known tables, so the user can quickly jump to them. This is similar to how other programs show some of their tools by default, helping the user know what things are possible with the application.

Also move the Table Tool to be the top tool for consistency.
2020-01-22 20:49:30 -06:00