Commit Graph

467 Commits

Author SHA1 Message Date
Benjamin Popp
432388de60 Caching Bugfix
* Only allow one scope to be created at a time, to avoid race conditions with modifying the activeScopes.
* Allow scopes to be created for the same model when a scope already exists. Use reference counting in this case.
* Change at what level several of the scopes are created at.
2019-06-13 22:10:44 -05:00
Benjamin Popp
309c4fcb64 Moving the translate-transform step down one level
so we can skip it in cells that no longer need it.
2019-06-13 21:04:14 -05:00
Benjamin Popp
5ab0c6d0a0 Introduce GlyphRuns for performance
We previously drew each cell individually. Now, in certain cases (most of them), we draw all the glyphs of one type at the same time. For example, all green Consolas font size 16 non-italic text on line 12 gets dtrawn at the same time.

Also introduced ModelCacheScope, a short-term cache that can be created / destroyed using IDisposable. Right now it's only used for PLMRuns, since each run is relatively short but they all want to calculate the same information from the model (namely, the move names). Eventually it would be good to remove the local caches from other runs as well and use the CacheScope for things like tables and egg moves.
2019-06-13 07:25:49 -05:00
Benjamin Popp
e746717697 Bugfix 2019-06-11 22:57:37 -05:00
Benjamin Popp
7b4ccf0a31 First attempt at drawing an entire row at once
We're not actually drawing an entire row at once: we're taking one pass per type of format. So we're drawing all the green italicized 16-size text in a single go, and then going back later to do blue text and so on.
2019-06-11 22:49:03 -05:00
Benjamin Popp
dbb831603e Zoom Performance Improvement
Use a visual cache for the None data format. Caching GlyphRuns is actually quite a bit better.
2019-06-10 22:33:58 -05:00
Benjamin Popp
645cc709cc Implement GlyphRun version
This version works a lot like the FormattedText version, but is slightly faster. We need to optimize more.
2019-06-10 22:19:58 -05:00
Benjamin Popp
fc1aae93b0 Abstract Drawing Logic
Make most of the drawing happen in a helper method, including the creation of FormattedText and the call to context.DrawText. This will let us change out the implementation easier.
2019-06-10 21:31:56 -05:00
Benjamin Popp
9b4b985023 Bugfix
Reuse brushes when possible. Don't crash when closing and super-zoomed out
2019-06-09 21:38:46 -05:00
Benjamin Popp
e0695115d1 Update Slanted Height on FontSize change 2019-06-09 21:18:55 -05:00
Benjamin Popp
c3c19ac99d Improve Zooming UI
Use `TruncateText` and `GetCenteredOffset` for PlmItems, EggItems, EggSections, Integers, Enums, Text, and Pointers.
2019-06-09 21:17:23 -05:00
Benjamin Popp
9227541ed6 Refactor
move the TruncateText logic to a helper method, since other methods will likely want something similar.
2019-06-09 15:49:18 -05:00
Benjamin Popp
5573c73238 Fix Centering for None and Pointer
CellTextOffset is now based on the dynamic width.
Pointers have updated logic for how many characters to display.
2019-06-09 15:44:05 -05:00
Benjamin Popp
5dc36d6bb9 Zooming Updates Cell Size
Cells should resize based on zoom level.
2019-06-09 13:48:16 -05:00
Benjamin Popp
b235997163 Connect ZoomLevel to FontSize
The cells are still always the same size, but the text zooms correctly now.
2019-06-09 13:25:33 -05:00
Benjamin Popp
216b125ff3 Zoom setup
Change CellWidth and CellHeight to be instance members of `HexContent` instead of static. This forces other components to look up the size (or get handed the size) instead of using a global. This will let us vary the width/height in the future.
Add 'ZoomLevel' concept to EditorViewModel, so we can save/load the zoom level. It doesn't currently connect to anything in the UI, but it will eventually map to font size, which will be used to calculate cell size.
2019-06-08 21:12:17 -05:00
Benjamin Popp
15b729fabd Version Bump 2019-06-08 14:07:43 -05:00
Benjamin Popp
19312af077 code cleanup
* Don't let the table tool write runs. This matters if the pointer is bugged and not actually pointing to stream data.
* Use IStreamRun interface where possible.
2019-06-08 14:04:42 -05:00
Benjamin Popp
6474b11938 Fix whitespace 2019-06-08 13:42:23 -05:00
Benjamin Popp
2697ea3dd2 Ascii improvements
* Backspace on an ascii run behaves better.
* Ascii run has right-click -> remove format option
2019-06-08 13:29:02 -05:00
Benjamin Popp
ba2bbeca7c Support search for level-up moves
"Vine Whip" now finds:
* Text
* Move data
* Pokemon that can learn it via egg moves
* Pokemon that can learn it via level-up
2019-06-08 12:50:24 -05:00
Benjamin Popp
9bddcbae31 label anchor streams
When looking at a stream that's tied to an anchor, show a name label based on which element points to it.
2019-06-08 11:04:24 -05:00
Benjamin Popp
0951c4737a update table edit goto logic
Only 'goto' start of table while editing anchor if we're editing the table format: editing the length should not reset the view.
2019-06-07 22:06:37 -05:00
Benjamin Popp
3ee24604de Support PLM runs in Gaia and Altair
Apparently some tool gives you moves at level 101 as padded filler. We should support decoding tables with moves learned at level 101 o_O

For known-length searches, we can keep looking to see if data is a match slightly after we find a bugged element. We can do this by expecting a certain percentage of errors in the data, somewhere between 1-2% is probably safe. This lets us find the right data even if the person editing the ROM made some mistakes.
2019-06-07 21:44:45 -05:00
Benjamin Popp
a67b2644f6 Fixing Clover
Clover has a pointer in its lvlmoves table that points to an empty moveset. But it's pokemon 0, so it doesn't matter. This is valid, I can support it.
2019-06-07 07:03:58 -05:00
Benjamin Popp
dd554edf18 Auto-Search lvlmoves: Emerald
Emerald didn't work because in Emerald, there's a false pointer at the start of one of the PLM runs. This is easy to correct: just add Pointer as a special case, since it is the only type of run that doesn't require having a name or pointer to it.
2019-06-06 21:55:06 -05:00
Benjamin Popp
e18b0e7d0c Bug Fix
When I'm clearing format to add a dependent pointer format, clear all the space needed by the new run, not just space used by the run that starts at the same point. This matters in the case of a false pointer that thinks it's pointing to text which ends at the same spot.
2019-06-06 20:55:38 -05:00
Benjamin Popp
293ad9000c Auto-search for descriptions in items table
In FireRed, we learned that there are some false pointers that were making the maxLength calculation cause the descriptions not to be found correctly.
In Ruby, the first item description is "" (length 1).
Found another bug for descriptions where we need to make sure to do a new binary search after removing pointers when changing table lengths.
2019-06-05 21:41:32 -05:00
Benjamin Popp
0c3653f13b Fixes to make auto-search work for FireRed 2019-06-04 22:58:32 -05:00
Benjamin Popp
802ffda1c8 Improvements while prepping for lvlmoves auto-search
auto-search doesn't actually work yet. But this is roughly what the code will be.
2019-06-04 22:46:38 -05:00
Benjamin Popp
e6a915dad5 Bugfix
When we call UpdateNewRunFromPointerFormat, it's possible that new runs could be added, or old runs can be removed. In that case, any index that we've calculated as to where in the list to put the new run could be incorrect. To keep the runs in order, we need to recalculate the index.
2019-06-04 02:32:55 -05:00
Benjamin Popp
cb97ef3008 update to use constant 2019-06-04 02:20:47 -05:00
Benjamin Popp
e5d06743c8 Pulling in the remaining useful fixes from dev1
* call SearhcForPointersToAnchor as late as possible
* support PLMRuns as inner pointer formats
* only allow for PLM runs to be auto-added if the data is the correct format.
* trim excess spaces off of inner format parsing
*
2019-06-04 02:18:40 -05:00
Benjamin Popp
26d7581368 Edit stream array elements to support plm runs
I previously thought I'd need a different type of run for each type of stream, so I made a text specific one. But I realized that the ViewModel's for both PCSRuns and PLMRuns would have very similar interfaces. Mostly, they need to expose a function to push data to the model, or pull data to a text string. So I added an interface that does that, and now they can both use the same ViewModel.
2019-06-04 01:47:29 -05:00
Benjamin Popp
44951fde72 Make ArrayRunPointerSegment support plm runs 2019-06-04 01:39:01 -05:00
Benjamin Popp
f42ef77b9c Require that anchors have non-zero length 2019-06-04 01:29:11 -05:00
Benjamin Popp
755e4a6b3b handle naming an existing format better.
adding a name no longer removes the format, until a new format is specified to replace it.
2019-06-04 01:16:21 -05:00
Benjamin Popp
2717aace5d Fix broken test
This test was failing because I accidentally put the plm run in the middle of the move table.
2019-06-03 21:24:42 -05:00
Benjamin Popp
33d5ddacbe Selection from text tool updates main selection for plm runs 2019-05-31 23:55:12 -05:00
Benjamin Popp
f511d38958 Plm Text Tool Support
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.
2019-05-31 23:36:13 -05:00
Benjamin Popp
9ea56b36c3 Autocomplete and backspace for PlmItems 2019-05-31 21:28:34 -05:00
Benjamin Popp
6e2c5834f7 PLM: Select in pairs 2019-05-30 22:14:49 -05:00
Benjamin Popp
b6b75deaae First push for PLM Streams
PLM Streams (pokemon learn moves)
I can now add streams via the ViewPort
2019-05-30 22:10:14 -05:00
Benjamin Popp
ffc8a76ad8 Update table pointer field when data gets moved 2019-05-27 20:19:10 -05:00
Benjamin Popp
76df0b7bb0 Add text pointer content to tool. 2019-05-27 14:01:09 -05:00
Benjamin Popp
3e00051cb5 Allow table pointers to point to PCS streams (text)
this is a lead-in for letting them point to other kinds of streams, like plm (learnable moves) streams.
2019-05-26 21:38:28 -05:00
Benjamin Popp
f6008308e0 Version Bump 2019-05-24 21:14:00 -05:00
Benjamin Popp
8cdecaa131 Context Menu Update
Add Copy/Paste context items for basically everything. Add "Remove Format" option for egg moves.
2019-05-24 21:03:50 -05:00
Benjamin Popp
b16e150967 Gaia Support
* 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.
2019-05-24 08:15:49 -05:00
Benjamin Popp
f4b83cadaa Merge branch 'dev-haven1433' into dev 2019-05-22 22:14:31 -05:00