mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 04:23:12 +00:00
SV TM/Fly cheats: do not modify non-existent blocks
New fly location and TM Machine flags do not exist on older save revisions, which would've thrown an exception
This commit is contained in:
parent
703e2ed5ad
commit
9510272149
2 changed files with 7 additions and 1 deletions
|
@ -343,10 +343,12 @@ public sealed class SAV9SV : SaveFile, ISaveBlock9Main, ISCBlockArray, ISaveFile
|
||||||
|
|
||||||
public void UnlockAllTMRecipes()
|
public void UnlockAllTMRecipes()
|
||||||
{
|
{
|
||||||
for (int i = 1; i <= 201; i++)
|
for (int i = 1; i <= 229; i++)
|
||||||
{
|
{
|
||||||
var flag = $"FSYS_UI_WAZA_MACHINE_RELEASE_{i:000}";
|
var flag = $"FSYS_UI_WAZA_MACHINE_RELEASE_{i:000}";
|
||||||
var hash = (uint)FnvHash.HashFnv1a_64(flag);
|
var hash = (uint)FnvHash.HashFnv1a_64(flag);
|
||||||
|
if (!Accessor.HasBlock(hash))
|
||||||
|
continue;
|
||||||
var block = Accessor.GetBlock(hash);
|
var block = Accessor.GetBlock(hash);
|
||||||
block.ChangeBooleanType(SCTypeCode.Bool2);
|
block.ChangeBooleanType(SCTypeCode.Bool2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,7 +276,11 @@ public partial class SAV_Trainer9 : Form
|
||||||
};
|
};
|
||||||
var accessor = SAV.Accessor;
|
var accessor = SAV.Accessor;
|
||||||
foreach (var block in blocks)
|
foreach (var block in blocks)
|
||||||
|
{
|
||||||
|
if (!accessor.HasBlock(block))
|
||||||
|
continue;
|
||||||
accessor.GetBlock(block).ChangeBooleanType(SCTypeCode.Bool2);
|
accessor.GetBlock(block).ChangeBooleanType(SCTypeCode.Bool2);
|
||||||
|
}
|
||||||
System.Media.SystemSounds.Asterisk.Play();
|
System.Media.SystemSounds.Asterisk.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue