Skip to content

Commit

Permalink
Fix e-reader searching
Browse files Browse the repository at this point in the history
  • Loading branch information
Admiral-Fish committed May 9, 2019
1 parent 5ba70ad commit 1c27dea
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
23 changes: 10 additions & 13 deletions Core/Gen3/ShadowLock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ bool ShadowLock::salamenceSet(u32 seed)
// Build PID of non-shadow
u32 pid = getPIDBackward(backward);

return team.getLock(0).compare(pid);
return currLock.compare(pid);
}

bool ShadowLock::salamenceShinySkip(u32 seed)
Expand All @@ -195,7 +195,7 @@ bool ShadowLock::salamenceShinySkip(u32 seed)
u32 pid = getPIDBackward(backward);

// Backwards nature lock check
return team.getLock(0).compare(pid);
return currLock.compare(pid);
}

bool ShadowLock::salamenceUnset(u32 seed)
Expand All @@ -206,7 +206,7 @@ bool ShadowLock::salamenceUnset(u32 seed)
u32 pid = getPIDBackward(backward);

// Backwards nature lock check
return team.getLock(0).compare(pid);
return currLock.compare(pid);
}

bool ShadowLock::singleNL(u32 seed)
Expand All @@ -217,7 +217,7 @@ bool ShadowLock::singleNL(u32 seed)
u32 pid = getPIDBackward(backward);

// Backwards nature lock check
return team.getLock(0).compare(pid);
return currLock.compare(pid);
}

// Needs more research
Expand All @@ -233,8 +233,10 @@ bool ShadowLock::eReader(u32 seed, u32 readerPID)
XDRNGR backward(seed, 1);
u32 pid;

// Backwards nature lock check loop
for (x = 1; x < backCount; x++)
x = 1;
compareBackwards(pid, backward);

for (x = 2; x < backCount; x++)
{
backward.advanceFrames(3);
compareBackwards(pid, backward);
Expand All @@ -247,13 +249,13 @@ bool ShadowLock::eReader(u32 seed, u32 readerPID)
compareForwards(pid, forward);
}

// Checks if first NL PID back from target matches
// Checks if PID matches original
return pid == readerPID;
}

void ShadowLock::switchLock(u8 lockNum, Method version)
{
natureLockSetup(lockNum, version);
team = ShadowTeam::loadShadowTeams(version).at(lockNum);

backCount = team.getSize();
frontCount = backCount == 1 ? 0 : backCount - 2;
Expand Down Expand Up @@ -307,8 +309,3 @@ u16 ShadowLock::getPSVReverse(XDRNGR &rng)
{
return (rng.nextUShort() ^ rng.nextUShort()) >> 3;
}

void ShadowLock::natureLockSetup(u8 lockNum, Method version)
{
team = ShadowTeam::loadShadowTeams(version).at(lockNum);
}
1 change: 0 additions & 1 deletion Core/Gen3/ShadowLock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class ShadowLock
u32 getPIDForward(XDRNG &rng);
u32 getPIDBackward(XDRNGR &rng);
u16 getPSVReverse(XDRNGR &rng);
void natureLockSetup(u8 lockNum, Method version);

};

Expand Down
2 changes: 1 addition & 1 deletion Forms/Gen3/GameCube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void GameCube::updateProfiles()
void GameCube::setupModels()
{
generatorModel = new Stationary3Model(ui->tableViewGenerator);
searcherModel = new Searcher3Model(ui->tableViewSearcher, Method::Method1);
searcherModel = new Searcher3Model(ui->tableViewSearcher, Method::XDColo);
generatorMenu = new QMenu(ui->tableViewGenerator);
searcherMenu = new QMenu(ui->tableViewSearcher);

Expand Down
1 change: 1 addition & 0 deletions Models/Gen3/Searcher3Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Searcher3Model::Searcher3Model(QObject *parent, Method method) :
void Searcher3Model::setMethod(Method method)
{
this->method = method;
emit headerDataChanged(Qt::Horizontal, 0, columnCount());
}

void Searcher3Model::sort(int column, Qt::SortOrder order)
Expand Down

0 comments on commit 1c27dea

Please sign in to comment.