|
JubeatPlus 3.9.11
|
Carries score records across a store version, recovering scores the old schema truncated. More...
#include <ScoreMigrationPolicy.h>


Instance Methods | |
| (BOOL) | - salvageScore:tid:bas:adv:ext: |
| Recovers the three original scores by searching for the ones the digest was taken over. | |
| (BOOL) | - createDestinationInstancesForSourceInstance:entityMapping:manager:error: |
| Creates the migrated record, verifying or recovering its scores first. | |
Carries score records across a store version, recovering scores the old schema truncated.
The old store kept each score in a 16-bit field alongside a 16-byte tamper digest computed over the untruncated values. On iOS 5 and later the truncation is visible, so the migration cannot simply copy the fields across: it has to work out what the original 32-bit scores were. It does that by brute force, in -salvageScore:tid:bas:adv:ext:.
| - (BOOL) createDestinationInstancesForSourceInstance: | (NSManagedObject *) | sInstance | |
| entityMapping: | (NSEntityMapping *) | mapping | |
| manager: | (NSMigrationManager *) | manager | |
| error: | (NSError **) | error |
Creates the migrated record, verifying or recovering its scores first.
Ignores every entity but "ScoreRecord". Below iOS 5.0 it takes the stored scores at face value and only checks the digest; from 5.0 upwards it goes through -salvageScore:tid:bas:adv:ext:. A record whose scores cannot be verified either way is silently dropped — no destination object is created and no error is reported.
| - (BOOL) salvageScore: | (NSManagedObject *) | source | |
| tid: | (int) | tuneID | |
| bas: | (int *) | bas | |
| adv: | (int *) | adv | |
| ext: | (int *) | ext |
Recovers the three original scores by searching for the ones the digest was taken over.
Each stored score is the low 16 bits of the original. The method tries every high half from 0 to 16 for each of the three charts, rejects any candidate above one million, recomputes the digest with +[ScoreRecord hashScoreforTune:bas:adv:ext:hash:], and compares all 16 bytes against the stored "chksco". The first exact match wins and is written back through the out-parameters.
A stored value of 0xFFFF combined with the first high half is treated as the sentinel 0xFFFFFFFF, which is how the schema spells "no score recorded" rather than a score of 65535.
| source | The record being migrated. |
| tuneID | The tune identifier, which is part of the digest. |
| bas | Out-parameter for the recovered basic score. Untouched unless the method answers YES. |
| adv | Out-parameter for the recovered advanced score. |
| ext | Out-parameter for the recovered extreme score. |