Rearranged network's After PSPAction creation/registration so that newer one have higher value to prevent network's callbacks triggering the wrong after action after loading from old save state.

This commit is contained in:
ANR2ME 2020-08-02 08:49:58 +07:00
parent f927ca795c
commit 90ff382c59
3 changed files with 18 additions and 10 deletions

View file

@ -141,10 +141,6 @@ void __NetApctlInit() {
netApctlState = PSP_NET_APCTL_STATE_DISCONNECTED;
apctlHandlers.clear();
memset(&netApctlInfo, 0, sizeof(netApctlInfo));
// Init Apctl Callbacks
apctlThreadHackAddr = __CreateHLELoop(apctlThreadCode, "sceNetApctl", "__NetApctlCallbacks", "apctlThreadHack");
actionAfterApctlMipsCall = __KernelRegisterActionType(AfterApctlMipsCall::Create);
}
static void __ResetInitNetLib() {
@ -155,6 +151,18 @@ static void __ResetInitNetLib() {
memset(&parameter, 0, sizeof(parameter));
}
void __NetCallbackInit() {
// Init Network Callbacks
dummyThreadHackAddr = __CreateHLELoop(dummyThreadCode, "sceNetAdhoc", "__NetTriggerCallbacks", "dummythreadhack");
matchingThreadHackAddr = __CreateHLELoop(matchingThreadCode, "sceNetAdhocMatching", "__NetMatchingCallbacks", "matchingThreadHack");
apctlThreadHackAddr = __CreateHLELoop(apctlThreadCode, "sceNetApctl", "__NetApctlCallbacks", "apctlThreadHack");
// Newer one should be placed last to prevent callbacks going to the wrong after action after loading from old save state
actionAfterMatchingMipsCall = __KernelRegisterActionType(AfterMatchingMipsCall::Create);
actionAfterAdhocMipsCall = __KernelRegisterActionType(AfterAdhocMipsCall::Create);
actionAfterApctlMipsCall = __KernelRegisterActionType(AfterApctlMipsCall::Create);
}
void __NetInit() {
// Windows: Assuming WSAStartup already called beforehand
portOffset = g_Config.iPortOffset;
@ -172,6 +180,7 @@ void __NetInit() {
__ResetInitNetLib();
__NetApctlInit();
__NetCallbackInit();
}
void __NetApctlShutdown() {