Commit Graph

303 Commits

Author SHA1 Message Date
Benjamin Popp
31472fea77 ViewPort.GetSelectionSpan needs to be decorator aware 2021-02-20 21:04:59 -06:00
Benjamin Popp
087a0260cc Support multiple game codes in the !game metacommand 2021-02-19 19:50:43 -06:00
Benjamin Popp
5a1caef595 Allow loading .hma files as paste scripts 2021-02-18 21:36:04 -06:00
Benjamin Popp
36bf79e91b Add ability for to import content to the current tab.
Planned uses:
* Import an ips/ups into a ViewPort
* Import a .hma paste script into a ViewPort
* Import an image into the image editor
2021-02-18 21:25:47 -06:00
Benjamin Popp
1fb13c1160 Add !game metacommand
Allow paste-scripts to have sections that are specific to what game the script is being run on. Allows for creation of a single script that works on multiple games.
2021-02-18 20:56:24 -06:00
Benjamin Popp
e726dd1676 Paste-script improvements
Allow @anchor(length) to create a new anchor in a location with at least (length) freespace. Length is in hex.
Allow thumb branch instructions to include an offset.
Allow goto instructions to include an offset.
2021-02-17 19:47:47 -06:00
Benjamin Popp
73ba6e79c6 Allow Combined Search Results
When multiple results are close together, allow them to be combined into a single result within the new tab. This makes the overall result shorter, and makes it easier to see when 2 pieces of data are near each other.
2021-02-13 23:22:01 -06:00
Benjamin Popp
ed6bc81796 Allow editing anchors from the middle. 2021-02-13 20:28:16 -06:00
Benjamin Popp
7c1f52ecee Make the Anchor visible from anywhere in the run 2021-02-13 20:15:01 -06:00
Benjamin Popp
4dff97f5c7 Allow search to find byte sequences that have XX wildcards in them 2021-02-12 22:18:54 -06:00
Benjamin Popp
b9f9eb0bf6 Improve OW updating logic
* update the palette link when the palette changes in the table tool
* update the selected palette when the sprite gets re-selected, even if the sprite was already selected.
2021-02-11 21:33:56 -06:00
Benjamin Popp
ce4f4d0206 Improve ChangeHistory
* Don't allow inserting a custom change during a transaction
* Don't end a transaction when a Goto happens because of a paste-script directive ( @{ or @} ).
2021-02-09 22:36:57 -06:00
Benjamin Popp
f419d5affa Update tests to not depend directly on ViewPort constructor
As part of this, make the ViewPort constructor's new parameter no longer optional.
2021-02-09 21:37:16 -06:00
Benjamin Popp
163293baf5 Refactor (part 1)
ViewPort should have IWorkDispatcher as a constructor paramater, not an .Edit parameter. Optional parameters that make the program act different between test mode and real mode are bad.

For the same reason, this should be a required parameter. But changing the constructor of ViewPort is hard, since so many tests use it. This is an initial refactor to make less tests use the constructor directly.
2021-02-09 20:24:16 -06:00
Benjamin Popp
8ba7446bfc Improve metacommand / directive logic
* 00 metacommand needs to clean up pointers that it deletes
* . directive needs to be disabled when editing text
2021-02-08 22:39:21 -06:00
Benjamin Popp
9b812f69ff Update logic for 00 metacommand
Previously, the command would error unless you're in freespace. This doesn't quite match how it needs to work.
* If a user tries to copy a table and then paste it over the same table in another rom, that should work. So table pasting should go ahead and clear the data and not error, even if it's not freespace.
* If a user tries to clear out a run with the intention of writing over it, all 00's may not be valid. If the length matches exactly, don't error and don't clear. Just nop.
2021-02-08 21:58:50 -06:00
Benjamin Popp
21e25870ea Fix table resizing bugs
Also fix a bug where deleting a single color doesn't work as expected. Allow all "appendto" runs to have custom delete behavior.
2021-02-08 16:58:24 -06:00
Benjamin Popp
0ad34e6b25 Inline tuple autocomplete
Tuple autocomplete is weird, because it happens in stages. This is different compared to other things, where choosing autocomplete always finishes the cell.
2021-02-05 21:30:04 -06:00
Benjamin Popp
278aa8e0e2 Fix cut/paste for type chart
copy for a type chart needs to not only copy the data, but the format of the data needed for pasting.
This is already the case, almost: we copy the table format for the stream table. However, adding the stream table won't work correctly unless we also paste the end token. Otherwise the initial length of the stream table will be wrong.

Update existing tests that use the !00 metacommand: the !00 metacommand should only change the data if the data is unused, and should only cause the model to stop the edit if the data is used.

Don't adjust the selection after a double-click-follow-link operation. Only adjust the selection after a double-click-select operation.
2021-01-26 13:37:42 -06:00
Benjamin Popp
373c13edb9 Auto-scroll left/right when selection changes. 2021-01-23 19:54:55 -06:00
Benjamin Popp
bb7cfb818d Improve PCS tool parsing
Show the hex values for escaped bytes in the text tool.
2021-01-20 21:56:28 -06:00
Benjamin Popp
6a4a3f62a2 Allow thumb in paste scripts
* ViewPort needs to be able to understand thumb directives. This means that .whatever must be interpreted as a directive and not as a constant. So constant names are required to *contain* at least one dot. For example, `.some.number`.
* When reading data that's been pasted in, if you find a `.thumb` directive, read until you find a `.end` directive, then interpret that whole thing as a thumb script, all at once.
* allow the `.end` directive to appear in thumb code
* `.align` directives should work in the viewport. Other directives that appear towards the top of thumb scripts before the `thumb` directive should be ignored.
2021-01-20 15:46:54 -06:00
Benjamin Popp
d4bc9f907b Don't crash when backspace on empty file. 2021-01-19 21:02:51 -06:00
Benjamin Popp
9fa9f35bc1 When clearing format, update the tools
This is important so that the tool doesn't contain references to deleted tables or images.
2021-01-19 20:48:58 -06:00
Benjamin Popp
ff45fd64c8 Bugfix
* Don't crash when backspace on an anchor
* Don't crash when using eyedropper tool on tileset
2021-01-18 23:15:05 -06:00
Benjamin Popp
20405d3595 Improve startup
* Don't offer to save on close if there's been no changes
* Save TOML *after* initialize
2021-01-07 20:13:44 -06:00
Benjamin Popp
8205618594 Add Background images for sprites 2020-12-31 16:05:17 -06:00
Benjamin Popp
2fb7236580 Introduce new decorator format
SpriteDecorator wraps other formats, providing the extra behavior of having a sprite background. This can be used to draw a sprite behind a single cell or behind a group of cells.

To get the z-ordering right, the info from SpriteDecorator is read during a new RenderBackground method, which happens before RenderData.
2020-12-31 14:32:38 -06:00
Benjamin Popp
fd4b47b81a Huge Performance Boost
Don't re-run gotoViewModel.RefreshOptions every time we run viewPort.RefreshBackingData
2020-12-24 20:56:34 -06:00
Benjamin Popp
b5e5f4f961 Improve load performance
Instead of initializing the model right away, launch a background task to do that. This allows the metadata to load while the tab draws itself. When initialization is complete, Refresh the ViewPort.

For the tests, use InstantDispatcher
2020-12-21 16:50:01 -06:00
Benjamin Popp
7ddb1a4860 Improve handling of broken pointers
If a pointer in a table points to the wrong type of data, we should recognize that and show that as an error pointer. For example, a pointer in a table that expects a compressed sprite, but gets an uncompressed one instead. In such cases, it should be possible to repoint from the bad data to new blank data.

If pointing to data that is the right type, but we don't point to the beginning of it, that should also allow the user to repoint to something fresh.
2020-12-07 22:31:17 -06:00
Benjamin Popp
e0e0ec23c8 Add "Export Backup" button 2020-11-28 22:53:09 -06:00
Benjamin Popp
31a6726cb7 Support writing 2-byte runs in the ViewModel 2020-11-23 13:47:51 -06:00
Benjamin Popp
b199bef1ff Selecting pointers cares about the destination, not just the run
if a pointer points into the middle of a run, that actual destination should be used for the table tool, not just the address of the table itself.
2020-11-21 23:02:23 -06:00
Benjamin Popp
2bf3792b2f Implement multi-page sprite import
Import now works for wide/tall images, where all the pages of an image are stored in the same image.
2020-11-07 22:29:39 -06:00
Benjamin Popp
4a8277ef48 When copying a table, include a blank-space metacommand
The metacommand will make sure that it's actually reasonable to write data to this location (no other data exists here) and will make sure that pointer data is initially set to null (so that deep copy for pointer content works correctly)
2020-11-02 22:45:32 -06:00
Benjamin Popp
61efff1d2d Add metacommand for writing compressed lz data
If a user wants to cut/paste an existing run to freespace, the new format must be able to be put in the new spot. This means that as part of writing a format that does validity checks (like compressed data), it must be possible to first write 'empty' valid data to the free space.
2020-11-02 21:59:28 -06:00
Benjamin Popp
07b973ea8d Add button to auto-repoint if a data conflict is found 2020-10-24 23:55:09 -05:00
Benjamin Popp
a48ed064fc Make palette control more aware of repoints
This requires that the palette control recognize a pointer to the current palette, instead of just the address of the current palette. But since palettes can't be used by the game without a pointer, it's reasonable that there will always be a pointer for any palette being edited.
* Update table tool / sprite tool / image editor palette addresses when palettes get repointed.
2020-10-15 22:21:43 -05:00
Benjamin Popp
b0b7a769d9 Updates from usability testing
Fix zoom limits
Fix selection move limits
Fix issue with 0 draw size when hovering with draw tool
Add tooltip for lz compression start token
Import from default TOML files on version upgrade.
Goto -> potion -> should work
File -> Save -> should work from image editor
Don't double-include the current table as a "related table" when searching for palette tables for a sprite.
2020-10-13 20:51:16 -05:00
Benjamin Popp
36a3ff1b4e Support editing later palettes
useful for multi-palette images like the frontier pass image, or type icons, or castform
2020-10-02 22:48:55 -05:00
Benjamin Popp
f8cdbce616 ImageEditor -> allow editing other pages of a sprite 2020-10-01 22:04:38 -05:00
Benjamin Popp
93c457a771 In the case of an edit error, don't run edit continuations 2020-09-21 07:20:43 -05:00
Benjamin Popp
396c2c8ca8 Start looking at hover rect during draw 2020-09-14 11:54:20 -05:00
Benjamin Popp
38d7680081 Introduce testing for Image Editor tab
We don't have a UI for the image editor tab yet. But we can now test the interactions. We've written the first test, and it's now possible to draw a single pixel.

... we'll need a lot more tests for this.
2020-09-10 22:26:18 -05:00
Benjamin Popp
fcab46ce82 Add tool tip for dex reorder tab title 2020-09-10 20:57:37 -05:00
Benjamin Popp
53ab13cef2 Freespace / Trainer Team updates
* Expanding a trainer team while looking at it (either via the table tool or via the inline '+' operator) will now cause you to jump to the new trainer team location.
* Expanding a trainer team through any method will now cause the trainer team's new element to be a duplicate of the previous last element, instead of bad bytes.
* You can press Enter to jump to the offset listed in the "Free Space" field
* New tooltip on the free space field
2020-09-09 21:04:02 -05:00
Benjamin Popp
7b79364017 Allow typing pointers at end 2020-09-08 06:58:59 -05:00
Benjamin Popp
bda55c8238 Allow copy at end 2020-09-08 06:58:47 -05:00
Benjamin Popp
8e0211ff66 Improve Paste-Script / Named Constant integration.
* allow editing constants using the @constant=value syntax
* allow jumping to specific constants using the @constant~index syntax
2020-09-04 23:16:04 -05:00