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.
This commit is contained in:
Benjamin Popp
2019-06-06 21:55:06 -05:00
parent e18b0e7d0c
commit dd554edf18
3 changed files with 16 additions and 2 deletions

View File

@@ -804,7 +804,10 @@ namespace HavenSoft.HexManiac.Core.Models {
var anchorRun = runs[index];
var newAnchorRun = anchorRun.RemoveSource(start);
changeToken.RemoveRun(anchorRun);
if (newAnchorRun.PointerSources.Count == 0 && !anchorForAddress.ContainsKey(newAnchorRun.Start)) {
// the only run that is allowed to exist with nothing pointing to it and no name is a pointer run.
// if it's any other kind of run with no name and no pointers to it, remove it.
if (newAnchorRun.PointerSources.Count == 0 && !anchorForAddress.ContainsKey(newAnchorRun.Start) && !(newAnchorRun is PointerRun)) {
runs.RemoveAt(index);
} else {
runs[index] = newAnchorRun;

View File

@@ -180,7 +180,7 @@ namespace HavenSoft.HexManiac.Core.Models.Runs {
if (destination == Pointer.NULL) return true;
var run = owner.GetNextAnchor(destination);
if (run.Start < destination) return false;
if (run.Start > destination || (run.Start == destination && run is NoInfoRun)) {
if (run.Start > destination || (run.Start == destination && (run is NoInfoRun || run is PointerRun))) {
// hard case: no format found, so check the data
if (InnerFormat == PCSRun.SharedFormatString) {
var length = PCSString.ReadString(owner, destination, true);

View File

@@ -156,6 +156,17 @@ namespace HavenSoft.HexManiac.Tests {
for (int i = 0; i < compareSet.Length; i++) Assert.Equal(compareSet[i], firstPokemonStats[i]);
}
[SkippableTheory]
[MemberData(nameof(PokemonGames))]
public void LvlUpMovesAreFound(string game) {
var model = LoadModel(game);
var noChange = new NoDataChangeDeltaModel();
var address = model.GetAddressFromAnchor(noChange, -1, "lvlmoves");
var run = (ArrayRun)model.GetNextAnchor(address);
Assert.NotNull(run);
}
[SkippableTheory]
[MemberData(nameof(PokemonGames))]
public void MoveDataFound(string game) {