As with most event work tampering, make sure you keep save backups. Accessing areas before you're intended to will almost certainly break story progression.
Existing `get`/`set` logic is flawed in that it doesn't work on Big Endian operating systems, and it allocates heap objects when it doesn't need to.
`System.Buffers.Binary.BinaryPrimitives` in the `System.Memory` NuGet package provides both Little Endian and Big Endian methods to read and write data; all the `get`/`set` operations have been reworked to use this new API. This removes the need for PKHeX's manual `BigEndian` class, as all functions are already covered by the BinaryPrimitives API.
The `StringConverter` has now been rewritten to accept a Span to read from & write to, no longer requiring a temporary StringBuilder.
Other Fixes included:
- The Super Training UI for Gen6 has been reworked according to the latest block structure additions.
- Cloning a Stadium2 Save File now works correctly (opening from the Folder browser list).
- Checksum & Sanity properties removed from parent PKM class, and is now implemented via interface.
For roamers, go back to Lake Valor/Fullmoon Island, and re-interact with Mesprit/Cresselia so that the game can generate a new one.
Also add Rotom rebattle event flag, and fix consistency with flag labels.
Closes#3318
Gen8: if held item, only give if can be legally held; if dmax crystal, only give if available.
Gen8b: if held item, only give if can be legally held
Others: unimplemented; pull requests accepted.
StreamingAssets\AssetAssistant\FureaiHiroba\fureai\masterdata\PoffinResult.json indicates which text line is used for a given MstID
Change Taste to Smooth to match community's naming
The RAM is pretty dirty for unallocated poffins; slots that have never been filled will have junk with whatever the unallocated pointer was looking at.
An empty poffin slot is just marked as FF, ignores the stats for that slot. Not sure on the naming, but Matt had a single Level 60 poffin -> must be Mild? Thus, all the names are -1 from the textfile array...
Closes#3305
I think it was actually crashing due to the bad GameClear date record, not this extra record data, but we'll still update the head record
Fix note of ENC_SV_DATA start offset now that we know the real size of Record8b
Add actual maximums for all record entries
because people couldn't hacc responsibly, I might as well give them a nudge in the right direction.
Doesn't mean I won't check your "random" choices distribution.
Yay abstractions to hide away the quirks.
BDSP traded eggs set HT_Friendship and the CurrentHandler flag, but the HatchCounter is always the OT_Friendship value.
Trades always receive BaseFriendship, instead of a hardcoded 50. Necessary to not hardcode because it's immutable for eggs.
Clicking the hatch counter label now sets it to the legal minimum hatch counter (best), and control clicking sets it to the max (worst). Check the encounter template for the true maximum.
Big thanks to @SciresM @sora10pls @Lusamine @architdate @ReignOfComputer for testing and contributing code / test cases. Can't add co-authors from the PR menu :(
Builds will fail because azure pipelines not yet updated with net6.
* Add metadata flagging for values
Allows users to set a minimum importance for the list displayed.
Could probably make this checkboxes within the flags UI.
* Add setting to filter out gen8 block names
Allows users to filter out unwanted low-value property names.
Co-authored-by: Kurt <kaphotics@gmail.com>
* Providing pkm/sav files via command line (dragging files onto exe / associated file launched) will more intelligently source a partner sav/pkm object if not provided.
* Gen1/2 mainline save files now indicate if they are VC era or GB era (legality implications) in the program title bar.
* Fixes loading VC era save backups not being recognized as VC era (`.bak` extension hides `.dat`)
* Export BAK moved to the SAV tab, which allows Export main to be deleted and Export SAV to be used as the single-click for exporting saves. `CTRL-E` is still the hotkey.
Startup, load gen5 save file.
Immediately load a pk3; met location is converted to Poketransfer
When data is prepared, the validation fails and the selectedvalue is reset to 0
Future selectedvalue sets will work
Just force validation when we change the list, so that future value sets work.
Weird winforms quirk
https://stackoverflow.com/questions/14624129/setting-combobox-droppeddown-false-resets-selected-item
Refer to previous commit, the apply-memory has a 1% chance of failing for 100% memories, resulting in the ability to have 0-memory HT via link trades.
In-game trades caused the previous logic, as those forget to set the HT memory (likely the same logic flaw as skipping the nickname check via game settings).
Slap on interface for EntreeSlot
De-magic some 💯 numbers to indicate what they're doing
Improve perf of move-match-relearn check
Add an "else" as valid is never both values (history verifier)
Closes#3240
Initial value is zero, so the "changed" event doesn't trigger, leaving the first combo item selected.
Co-Authored-By: CanoeHope <43196464+CanoeHope@users.noreply.github.com>
Was for cyber gadget save editor, restoring a segment that was all FF's causing it to corrupt.
Pretty sure they fixed the underlying error since it was originally found in 2014, but Cyber Gadget ceased operation of their save editor services back over a year ago, so this is no longer needed.
14/08/31 - New Update: (3900)
- Added: Cyber screwup notification upon saving.
- - If a 0x200 byte chunk is all 0xFF, your save will be corrupt when you write it back (not PKHeX's fault).
Should check 3-5, not 1-5, as VC transfers have separate ECs.
Replace the .Visible check; if the control isn't on the current tab page, it might report itself as invisible, and not update the text.
EncounterArea now stores a more specific type'd array for encounter slots. Better iteration and less casting, as the nonspecific `Slots` fetch is rarely referenced.
EncounterType renamed to GroundTile to reflect how it actually works in Gen4. Was previously an ambiguous field that was clarified a little; we can describe it a little better now. Keep the GUI the same to not scare the end users.
Change Trash Byte properties to get/set a Span. Trash Byte legality checking easier on the garbage collector?
off by 1 max range for gen2 slot -> pk2
SetRandomIVs already sets IVs inside the method, retval is for knowing what the new value sare
show WC8 restricted version rather than defaulting to SH
pass the rand object rather than fetching for the current thread every loop for Unown & random IV shuffling
Use ToLowerInvariant for resource fetching, should resolve the turkish issue
Check typeof(T) first, not that we check for ToolStripItem or ContextMenuStrip with this function.
* Track a PKM's Box,Slot,StorageFlags,Identifier metadata separately
Don't store within the object, track the slot origin data separately.
Batch editing now pre-filters if using Box/Slot/Identifier logic; split up mods/filters as they're starting to get pretty hefty.
- Requesting a Box Data report now shows all slots in the save file (party, misc)
- Can now exclude backup saves from database search via toggle (separate from settings preventing load entirely)
- Replace some linq usages with direct code
* Remove WasLink virtual in PKM
Inline any logic, since we now have encounter objects to indicate matching, rather than the proto-legality logic checking properties of a PKM.
* Use Fateful to directly check gen5 mysterygift origins
No other encounter types in gen5 apply Fateful
* Simplify double ball comparison
Used to be separate for deferral cases, now no longer needed to be separate.
* Grab move/relearn reference and update locally
Fix relearn move identifier
* Inline defog HM transfer preference check
HasMove is faster than getting moves & checking contains. Skips allocation by setting values directly.
* Extract more met location metadata checks: WasBredEgg
* Replace Console.Write* with Debug.Write*
There's no console output UI, so don't include them in release builds.
* Inline WasGiftEgg, WasEvent, and WasEventEgg logic
Adios legality tags that aren't entirely correct for the specific format. Just put the computations in EncounterFinder.
Farewell secret base descriptions. Not like the localized names would be too useful, but git history can keep em around if we ever need to reference them again (pls no)
Closes#3177
Format sizes are now accurate to game structure sizes. Added a few more editable fields, rid of label/textbox/etc for general base editing -- use a PropertyGrid instead.
Feels nice having a bank of saves to reference + idb to discover the struct layout.
More in line with modernizing the codebase with latest c# syntax
improve web-qr decode speed slightly (no linq skiptake)
get money/coin mask without a temporary string (lol performance)
Closes#3194
Exports are fine, imports with an ambiguous language (can be either JPN or INT) while illegal don't result in the above branches passing it.
Inputs with <=6 chars for OT&Nick will be ambiguous; PKM editor.
- Settings now stored as json next to exe
- Settings now exposes all legality checking setttings that can be changed
- Slot hovering now can play cries in MGDB/PKMDB/etc, not just the main boxes.
- Enhanced hover text for mystery gifts and encounters that have movesets
- Show recently loaded save files in ctrl-f browser
- Toggle auto-load savefile setting to be none/detect-latest/last-loaded
- Custom extensions & extra backup paths can now be configured directly in the json settings
- Settings editor now uses propertygrid & tabs.
Mostly because of Gen3 save editing bugfixes, forcing a new version.
Last version added the PID checks for Gen8; this one adds move ordering checks for eggs. More fun :)
* Exploration: rework ability criteria to ability numbers desired
* Sync remaining changes
* Update EncounterCriteria.cs
* Add xmldoc
* Improve speed of IsDualGender check
* More xmldoc updates
Should be doing this on main but meh, this branch is gonna get merged later
* Fix typo
* Update WC7.cs
* Update PersonalInfo.cs
Disassociate pk4/pk6 backing byte[] when converting to pk5|pk7, as we no longer make a copy of the byte[] in the pkm's constructor.
Change UpdatePKM to include isParty, as we want it optional to update FormArgument too.
Change FormArgument saving to be handled by FormConverter; kinda not really good to have it there, but nothing else is handling FormArgument values.
Expand IFormArgument to have all FormArgument values exposed. "Maximum" is furfrou only.
PK6: Max is in the "FormArgument" u32, and the remain/elapsed is in party stats (hence the reverting when boxed)
PK7: u8 remain, u8 elapsed, u8 max, u8 unused.
PK8: assumedly the same as PK7, given the disassembly hints that it's the same as past games (even though Furfrou and Hoopa are not in SWSH).
## Issue
We want to discard-but-remember any slots that aren't a perfect fit, on the off chance that a better one exists later in the search space. If there's no better match, then we gotta go with what we got.
## Example:
Wurmple exists in area `X`, and also has a more rare slot for Silcoon, with the same level for both slots.
* We have a Silcoon that we've leveled up a few times.
Was our Silcoon originally a Wurmple, or was it caught as a Silcoon?
* To be sure, we have to check the EC/PID if the Wurmple wouldn't evolve into Cascoon instead.
* We don't want to wholly reject that Wurmple slot, as maybe the Met Level isn't within Silcoon's slot range.
---
Existing implementation would store "deferred" matches in a list; we only need to keep 1 of these matches around (less allocation!). We also want to differentiate between a "good" deferral and a "bad" deferral; I don't think this is necessary but it's currently used by Mystery Gift matching (implemented for the Eeveelution mystery gifts which matter for evolution moves).
The existing logic didn't use inheritance, and instead had static methods being reused across generations. Quite kludgy. Also, the existing logic was a pain to modify the master encounter yield methods, as one generation's quirks had to not impact all other generations that used the method.
---
The new implementation splits out the encounter yielding methods to be separate for each generation / subset. Now, things don't have to check `WasLink` for Gen7 origin, because Pokémon Link wasn't a thing in Gen7.
---
## Future
Maybe refactoring yielders into "GameCores" that expose yielding behaviors / properties, rather than the static logic. As more generations and side-gamegroups get added (thanks LGPE/GO/GameCube), all this switch stuff gets annoying to maintain instead of just overriding/inheritance.
## Conclusion
This shouldn't impact any legality results negatively; if you notice any regressions, report them! This should reduce false flags where we didn't defer-discard an encounter when we should have (wild area mons being confused with raids).
Retain a stringbuilder to mutate the string rather than finalizing temporary strings
yields some speed improvements (less gen0 string objects allocated)
Closes#2954 ; can set directly from propertygrid already, but might as well clean things up a little bit to match the disassembly logic.
Open the simple editor center parent rather than next-form-position
Add xmldoc
Remove linq from memecrypto code (speed lmao)
Hide some methods that shouldn't be called directly
Name variables better for accessor const's
Gen7 started up showing a form=-1 marshadow, initialize the combobox with an empty string since we no longer set formlist if it has none
label/combobox visibility should be managed by gen2 flowlayout case below
Shows a dropdown for alcremie only, and a number entry for everything else.
See 771086a222 for initial implementation; I don't want the lag anymore lol
The save editor buttons were originally checked for visibility in order to determine if we should hide the groupbox completely. This didn't work if the groupbox wasn't being displayed (get visibility checks if it is currently rendered, in addition to can be shown). So the "enabled" state was used to determine if it should be shown.
Now that we have the "Blocks" raw editing always being shown, the GroupBox will always be shown. Can just set the visibility directly, rather than doing the workaround.
Make the hall of fame editors slightly less SaveFile_type-specific.
AltForm & Form & Forme => Form
GenNumber & Generation => Generation
Extract out SpeciesForm interface, and re-add IGeneration
For those using PKHeX as a dependency, this should be a pretty straightforward manual replacement... GenNumber and AltForm should be quick find-replace`s.
Trees:
- Only retain the objects needed after calculation
- Reduce size of TreeCoordinates and remove allocation penalty (now a struct)
No more warnings for Release compilation :D
Move form-info logic from FormConverter to AltFormInfo; now FormConverter is entirely form=>string[]
Add a bunch of xmldoc
Make pogo no-end-date cmp agaisnt UTCnow rather than local now.
GUI: Ctrl click star to get shiny1, shift click for shiny0, any-click to get random
make Alt click modify the SID instead of PID
add SetShinySID shiny type
Handle all warnings
obviously the usage of null! could potentially be avoided if the object init wasn't such garbage, but here we are with years of old junk and lack of abstraction in the GUI project
Closes#3028
Thanks @CarlosofKalos !
Setting 9999 for both on Rattata; capturing the 10,000th didn't increment, but transferring the 10,000th did.
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>