Skip to content

Commit

Permalink
Merge pull request #13278 from ANR2ME/fake_auth
Browse files Browse the repository at this point in the history
An attempt to fake PSN authentication
  • Loading branch information
hrydgard committed Aug 12, 2020
2 parents 27c059b + 2620957 commit ee3b822
Show file tree
Hide file tree
Showing 3 changed files with 633 additions and 37 deletions.
22 changes: 22 additions & 0 deletions Core/HLE/sceNet.cpp
Expand Up @@ -44,6 +44,7 @@
#include "Core/HLE/proAdhoc.h"
#include "Core/HLE/sceNetAdhoc.h"
#include "Core/HLE/sceNet.h"
#include "Core/HLE/sceNp.h"
#include "Core/Reporting.h"
#include "Core/Instance.h"

Expand Down Expand Up @@ -481,6 +482,27 @@ void __NetApctlCallbacks()
}
}

// We are temporarily borrowing APctl thread for NpAuth callbacks for testing to simulate authentication
if (!npAuthEvents.empty())
{
auto args = npAuthEvents.front();
auto id = &args.data[0];
auto result = &args.data[1];
auto argAddr = &args.data[2];
npAuthEvents.pop_front();

delayus = (adhocEventDelayMS + 2 * adhocExtraPollDelayMS) * 1000;

int handlerID = *id - 1;
for (std::map<int, NpAuthHandler>::iterator it = npAuthHandlers.begin(); it != npAuthHandlers.end(); ++it) {
if (it->first == handlerID) {
DEBUG_LOG(SCENET, "NpAuthCallback [HandlerID=%i][RequestID=%d][Result=%d][ArgsPtr=%08x]", it->first, *id, *result, it->second.argument);
// TODO: Update result / args.data[1] with the actual ticket length (or error code?)
hleEnqueueCall(it->second.entryPoint, 3, args.data);
}
}
}

// Must be delayed long enough whenever there is a pending callback.
hleDelayResult(0, "Prevent Apctl thread from blocking", delayus);
}
Expand Down

0 comments on commit ee3b822

Please sign in to comment.