Repository navigation
[FEAT] [DRAFT] Polished Crystal integration - #1174
merlinnerd922 wants to merge 4 commits into
Conversation
andrewbenington
left a comment
There was a problem hiding this comment.
I know this is still a work in progress, so I'm sure some of the things I mention were planned to be changed anyways. Overall it looks good! Thanks for your work on this!
| personality_value: 0, | ||
| encryption_constant: 0, |
There was a problem hiding this comment.
personality value should be generated using pkm_rs::convert_strategy::personality_value::generate_pid_matching_fields(). I would set the encryption constant to the same value, that's what Poké Transporter does.
right now I imagine this code will result in all mons of the same evolution family from Polished Crystal being treated as clones of each other
There was a problem hiding this comment.
Ah, oops...didn't realize this would be a thing. Will fix.
| let met_data = converter.met_data(ohpkm); | ||
|
|
||
| let mut mon = Self { | ||
| encryption_constant: 0, |
There was a problem hiding this comment.
I'm assuming you havent gotten to implementing this yet. is there a reason you wouldn't just use the encryption constant from the ohpkm?
There was a problem hiding this comment.
I could definitely do that! I just wasn't sure if encryption constants are even used in Polished Crystal.
| let mut mon = Self { | ||
| encryption_constant: 0, | ||
| sanity: 0, | ||
| checksum: 0, |
There was a problem hiding this comment.
also assuming this is a todo?
There was a problem hiding this comment.
Yep! Apologies; should highlight that.
I do think some of these values aren't necessarily used in Polished Crystal though, so some may be placeholders.
| type WasmPkmInterface<P> = PKMInterface & { inner: P } | ||
|
|
||
| type WasmSaveClass<S> = { | ||
| export type WasmSaveClass<S> = { |
There was a problem hiding this comment.
why did you need to export this?
There was a problem hiding this comment.
I believe because it was being used elsewhere and it wouldn't work without an exportation.
There was a problem hiding this comment.
Right, but I'm wondering why you are using it elsewhere. The other Wasm save types didn't require this to be used elsewhere
There was a problem hiding this comment.
Will try removing and see if there are errors.
| case 'PK2': { | ||
| case 'PK2': | ||
| case 'PK2PolishedCrystal': { | ||
| const gen12Identifier = getMonGen12Identifier(mon) |
There was a problem hiding this comment.
does polished crystal have an encryption constant or personality value? I thought I saw an encryption constant in your struct
There was a problem hiding this comment.
The way the code is now, the fields are mandatory if we implement certain traits in Rust, but I don't believe they're actually being used.
There was a problem hiding this comment.
The fields are mandatory to derive the IsShiny trait automatically (via #[derive(IsShiny8192)] or #[derive(IsShiny4096)]), because those macros use either the personality value (8192) or encryption constant (4096) in tandem with the trainer/secret ids to calculate shininess. They should probably be renamed to #[derive(PersonalityValueShiny)] and #[derive(EncryptionConstantShiny)] respectively, sorry about the ambiguity.
Regardless, you should only be using those derives if Polished Crystal calculates shininess via personality value or encryption constant. Otherwise, you should implement the IsShiny trait manually.
There was a problem hiding this comment.
I'll determine how Polished Crystal calculates shininess. But I have a gut instinct that because they decoupled determination of shininess from the way the original Crystal does it that it will need to be different.
|
Andrew, thanks again for checking all this and verifying I'm on the right track! I know your schedule is busy so I appreciate it. |
759f068 to
28c686f
Compare
13937fa to
488a411
Compare
Description
Preliminary changes to start integrated Polished Crystal as well as all games based in that engine.
Issue
This PR exists merely for others to provide feedback.