mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Merge pull request #19797 from Nemoumbra/net-adhoc-split
Split out Adhoc matching from the main sceNetAdhoc file.
This commit is contained in:
16 files changed
+2907
-2745
No files matched your search
@@ -2249,6 +2249,8 @@ add_library(${CoreLibName} ${CoreLinkType}
|
||||
Core/HLE/sceNet.h
|
||||
Core/HLE/sceNetAdhoc.cpp
|
||||
Core/HLE/sceNetAdhoc.h
|
||||
Core/HLE/sceNetAdhocMatching.cpp
|
||||
Core/HLE/sceNetAdhocMatching.h
|
||||
Core/HLE/proAdhoc.h
|
||||
Core/HLE/proAdhoc.cpp
|
||||
Core/HLE/proAdhocServer.h
|
||||
|
||||
@@ -721,6 +721,7 @@
|
||||
<ClCompile Include="HLE\sceMpeg.cpp" />
|
||||
<ClCompile Include="HLE\sceNet.cpp" />
|
||||
<ClCompile Include="HLE\sceNetAdhoc.cpp" />
|
||||
<ClCompile Include="HLE\sceNetAdhocMatching.cpp" />
|
||||
<ClCompile Include="HLE\sceNp.cpp" />
|
||||
<ClCompile Include="HLE\sceOpenPSID.cpp" />
|
||||
<ClCompile Include="HLE\sceParseHttp.cpp" />
|
||||
@@ -1293,6 +1294,7 @@
|
||||
<ClInclude Include="HLE\sceMpeg.h" />
|
||||
<ClInclude Include="HLE\sceNet.h" />
|
||||
<ClInclude Include="HLE\sceNetAdhoc.h" />
|
||||
<ClInclude Include="HLE\sceNetAdhocMatching.h" />
|
||||
<ClInclude Include="HLE\sceNp.h" />
|
||||
<ClInclude Include="HLE\sceOpenPSID.h" />
|
||||
<ClInclude Include="HLE\sceParseHttp.h" />
|
||||
|
||||
@@ -520,6 +520,9 @@
|
||||
<ClCompile Include="HLE\sceNetAdhoc.cpp">
|
||||
<Filter>HLE\Libraries</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HLE\sceNetAdhocMatching.cpp">
|
||||
<Filter>HLE\Libraries</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Dialog\PSPGamedataInstallDialog.cpp">
|
||||
<Filter>Dialog</Filter>
|
||||
</ClCompile>
|
||||
@@ -1725,6 +1728,9 @@
|
||||
<ClInclude Include="HLE\sceNetAdhoc.h">
|
||||
<Filter>HLE\Libraries</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HLE\sceNetAdhocMatching.h">
|
||||
<Filter>HLE\Libraries</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Dialog\PSPGamedataInstallDialog.h">
|
||||
<Filter>Dialog</Filter>
|
||||
</ClInclude>
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include "sceMp3.h"
|
||||
#include "sceNet.h"
|
||||
#include "sceNetAdhoc.h"
|
||||
#include "sceNetAdhocMatching.h"
|
||||
#include "sceNp.h"
|
||||
#include "sceMpeg.h"
|
||||
#include "sceOpenPSID.h"
|
||||
@@ -237,6 +238,9 @@ void RegisterAllModules() {
|
||||
Register_sceFont();
|
||||
Register_sceNet();
|
||||
Register_sceNetAdhoc();
|
||||
Register_sceNetAdhocMatching();
|
||||
Register_sceNetAdhocDiscover();
|
||||
Register_sceNetAdhocctl();
|
||||
Register_sceRtc();
|
||||
Register_sceWlanDrv();
|
||||
Register_sceMpeg();
|
||||
|
||||
@@ -1271,36 +1271,6 @@ void notifyAdhocctlHandlers(u32 flag, u32 error) {
|
||||
__UpdateAdhocctlHandlers(flag, error);
|
||||
}
|
||||
|
||||
// Matching callback is void function: typedef void(*SceNetAdhocMatchingHandler)(int id, int event, SceNetEtherAddr * peer, int optlen, void * opt);
|
||||
// Important! The MIPS call need to be fully executed before the next MIPS call invoked, as the game (ie. DBZ Tag Team) may need to prepare something for the next callback event to use
|
||||
// Note: Must not lock peerlock within this function to prevent race-condition with other thread whos owning peerlock and trying to lock context->eventlock owned by this thread
|
||||
void notifyMatchingHandler(SceNetAdhocMatchingContext * context, ThreadMessage * msg, void * opt, u32_le &bufAddr, u32_le &bufLen, u32_le * args) {
|
||||
// Don't share buffer address space with other mipscall in the queue since mipscalls aren't immediately executed
|
||||
MatchingArgs argsNew = { 0 };
|
||||
u32_le dataBufLen = msg->optlen + 8; //max(bufLen, msg->optlen + 8);
|
||||
u32_le dataBufAddr = userMemory.Alloc(dataBufLen); // We will free this memory after returning from mipscall. FIXME: Are these buffers supposed to be taken/pre-allocated from the memory pool during sceNetAdhocMatchingInit?
|
||||
uint8_t *dataPtr = Memory::GetPointerWriteRange(dataBufAddr, dataBufLen);
|
||||
if (dataPtr) {
|
||||
memcpy(dataPtr, &msg->mac, sizeof(msg->mac));
|
||||
if (msg->optlen > 0)
|
||||
memcpy(dataPtr + 8, opt, msg->optlen);
|
||||
|
||||
argsNew.data[1] = msg->opcode;
|
||||
argsNew.data[2] = dataBufAddr;
|
||||
argsNew.data[3] = msg->optlen;
|
||||
argsNew.data[4] = dataBufAddr + 8; // OptData Addr
|
||||
}
|
||||
else {
|
||||
argsNew.data[1] = PSP_ADHOC_MATCHING_EVENT_ERROR; // not sure where to put the error code for EVENT_ERROR tho
|
||||
//argsNew.data[2] = dataBufAddr; // FIXME: Is the MAC address mandatory (ie. can't be null pointer) even for EVENT_ERROR? Where should we put this MAC data in the case we failed to allocate the memory? may be on the memory pool?
|
||||
}
|
||||
argsNew.data[0] = context->id;
|
||||
argsNew.data[5] = context->handler.entryPoint; //not part of callback argument, just borrowing a space to store callback address so i don't need to search the context first later
|
||||
|
||||
// ScheduleEvent_Threadsafe_Immediate seems to get mixed up with interrupt (returning from mipscall inside an interrupt) and getting invalid address before returning from interrupt
|
||||
__UpdateMatchingHandler(argsNew);
|
||||
}
|
||||
|
||||
void freeFriendsRecursive(SceNetAdhocctlPeerInfo * node, int32_t* count) {
|
||||
// End of List
|
||||
if (node == NULL) return;
|
||||
|
||||
@@ -1131,10 +1131,6 @@ int findFreeMatchingID();
|
||||
*/
|
||||
SceNetAdhocMatchingContext * findMatchingContext(int id);
|
||||
|
||||
/*
|
||||
* Notify Matching Event Handler
|
||||
*/
|
||||
void notifyMatchingHandler(SceNetAdhocMatchingContext * context, ThreadMessage * msg, void * opt, u32_le &bufAddr, u32_le &bufLen, u32_le * args);
|
||||
// Notifiy Adhocctl Handlers
|
||||
void notifyAdhocctlHandlers(u32 flag, u32 error);
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
#include "sceMpeg.h"
|
||||
#include "sceNet.h"
|
||||
#include "sceNetAdhoc.h"
|
||||
#include "sceNetAdhocMatching.h"
|
||||
#include "scePower.h"
|
||||
#include "sceUtility.h"
|
||||
#include "sceUmd.h"
|
||||
@@ -145,6 +146,7 @@ void __KernelInit()
|
||||
__FontInit();
|
||||
__NetInit();
|
||||
__NetAdhocInit();
|
||||
__NetAdhocMatchingInit();
|
||||
__VaudioInit();
|
||||
__CheatInit();
|
||||
__HeapInit();
|
||||
@@ -188,6 +190,7 @@ void __KernelShutdown()
|
||||
__VideoPmpShutdown();
|
||||
__AACShutdown();
|
||||
__NetAdhocShutdown();
|
||||
__NetAdhocMatchingShutdown();
|
||||
__NetShutdown();
|
||||
__FontShutdown();
|
||||
|
||||
|
||||
+3
-1
@@ -42,6 +42,7 @@
|
||||
|
||||
#include "Core/HLE/proAdhoc.h"
|
||||
#include "Core/HLE/sceNetAdhoc.h"
|
||||
#include "Core/HLE/sceNetAdhocMatching.h"
|
||||
#include "Core/HLE/sceNet.h"
|
||||
#include "Core/HLE/sceNp.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
@@ -567,8 +568,9 @@ static inline void FreeUser(u32 &addr) {
|
||||
u32 Net_Term() {
|
||||
// May also need to Terminate netAdhocctl and netAdhoc to free some resources & threads, since the game (ie. GTA:VCS, Wipeout Pulse, etc) might not called them before calling sceNetTerm and causing them to behave strangely on the next sceNetInit & sceNetAdhocInit
|
||||
NetAdhocctl_Term();
|
||||
NetAdhocMatching_Term();
|
||||
NetAdhoc_Term();
|
||||
|
||||
|
||||
// TODO: Not implemented yet
|
||||
NetApctl_Term();
|
||||
//NetInet_Term();
|
||||
|
||||
+31
-2704
File diff suppressed because it is too large.
Load diff
+12
-6
@@ -20,19 +20,17 @@
|
||||
#include <deque>
|
||||
#include "Core/HLE/proAdhoc.h"
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(push,1)
|
||||
#endif
|
||||
typedef struct MatchingArgs {
|
||||
u32_le data[6]; // ContextID, EventID, bufAddr[ to MAC], OptLen, OptAddr[, EntryPoint]
|
||||
} PACK MatchingArgs;
|
||||
|
||||
typedef struct SceNetAdhocDiscoverParam {
|
||||
u32_le unknown1; // SleepMode? (ie. 0 on on Legend Of The Dragon, 1 on Dissidia 012)
|
||||
char groupName[ADHOCCTL_GROUPNAME_LEN];
|
||||
u32_le unknown2; // size of something? (ie. 0x3c on Legend Of The Dragon, 0x14 on Dissidia 012) // Note: the param size is 0x14 may be it can contains extra data too?
|
||||
u32_le result; // inited to 0?
|
||||
} PACK SceNetAdhocDiscoverParam;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
@@ -96,13 +94,15 @@ enum AdhocDiscoverResult : int
|
||||
class PointerWrap;
|
||||
|
||||
void Register_sceNetAdhoc();
|
||||
void Register_sceNetAdhocDiscover();
|
||||
void Register_sceNetAdhocctl();
|
||||
|
||||
|
||||
u32_le __CreateHLELoop(u32_le* loopAddr, const char* sceFuncName, const char* hleFuncName, const char* tagName = NULL);
|
||||
void __NetAdhocInit();
|
||||
void __NetAdhocShutdown();
|
||||
void __NetAdhocDoState(PointerWrap &p);
|
||||
void __UpdateAdhocctlHandlers(u32 flags, u32 error);
|
||||
void __UpdateMatchingHandler(const MatchingArgs ¶ms);
|
||||
|
||||
bool __NetAdhocConnected();
|
||||
|
||||
@@ -114,7 +114,7 @@ int sceNetAdhocctlJoin(u32 scanInfoAddr);
|
||||
int sceNetAdhocctlScan();
|
||||
int sceNetAdhocctlGetScanInfo(u32 sizeAddr, u32 bufAddr);
|
||||
|
||||
int NetAdhocMatching_Term();
|
||||
|
||||
int NetAdhocctl_Term();
|
||||
int NetAdhocctl_GetState();
|
||||
int NetAdhocctl_Create(const char* groupName);
|
||||
@@ -140,3 +140,9 @@ extern u32_le dummyThreadCode[3];
|
||||
extern u32 matchingThreadHackAddr;
|
||||
extern u32_le matchingThreadCode[3];
|
||||
|
||||
// Exposing those for the matching routines
|
||||
int sceNetAdhocPdpSend(int id, const char* mac, u32 port, void* data, int len, int timeout, int flag);
|
||||
int sceNetAdhocPdpRecv(int id, void* addr, void* port, void* buf, void* dataLength, u32 timeout, int flag);
|
||||
int sceNetAdhocPdpCreate(const char* mac, int port, int bufferSize, u32 flag);
|
||||
int NetAdhoc_SetSocketAlert(int id, s32_le flag);
|
||||
int NetAdhocPdp_Delete(int id, int unknown);
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,44 @@
|
||||
// Copyright (c) 2025- PPSSPP Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0 or later versions.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Core/HLE/proAdhoc.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(push,1)
|
||||
#endif
|
||||
typedef struct MatchingArgs {
|
||||
u32_le data[6]; // ContextID, EventID, bufAddr[ to MAC], OptLen, OptAddr[, EntryPoint]
|
||||
} PACK MatchingArgs;
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
class PointerWrap;
|
||||
|
||||
int NetAdhocMatching_Term();
|
||||
|
||||
void DoNetAdhocMatchingInited(PointerWrap &p);
|
||||
void DoNetAdhocMatchingThreads(PointerWrap &p);
|
||||
void ZeroNetAdhocMatchingThreads();
|
||||
void SaveNetAdhocMatchingInited();
|
||||
void RestoreNetAdhocMatchingInited();
|
||||
|
||||
void Register_sceNetAdhocMatching();
|
||||
void __NetAdhocMatchingInit();
|
||||
void __NetAdhocMatchingShutdown();
|
||||
@@ -230,6 +230,7 @@
|
||||
<ClInclude Include="..\..\Core\HLE\sceMt19937.h" />
|
||||
<ClInclude Include="..\..\Core\HLE\sceNet.h" />
|
||||
<ClInclude Include="..\..\Core\HLE\sceNetAdhoc.h" />
|
||||
<ClInclude Include="..\..\Core\HLE\sceNetAdhocMatching.h" />
|
||||
<ClInclude Include="..\..\Core\HLE\sceNp.h" />
|
||||
<ClInclude Include="..\..\Core\HLE\sceOpenPSID.h" />
|
||||
<ClInclude Include="..\..\Core\HLE\sceP3da.h" />
|
||||
@@ -483,6 +484,7 @@
|
||||
<ClCompile Include="..\..\Core\HLE\sceMt19937.cpp" />
|
||||
<ClCompile Include="..\..\Core\HLE\sceNet.cpp" />
|
||||
<ClCompile Include="..\..\Core\HLE\sceNetAdhoc.cpp" />
|
||||
<ClCompile Include="..\..\Core\HLE\sceNetAdhocMatching.cpp" />
|
||||
<ClCompile Include="..\..\Core\HLE\sceNp.cpp" />
|
||||
<ClCompile Include="..\..\Core\HLE\sceOpenPSID.cpp" />
|
||||
<ClCompile Include="..\..\Core\HLE\sceP3da.cpp" />
|
||||
|
||||
@@ -459,6 +459,9 @@
|
||||
<ClCompile Include="..\..\Core\HLE\sceNetAdhoc.cpp">
|
||||
<Filter>HLE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\Core\HLE\sceNetAdhocMatching.cpp">
|
||||
<Filter>HLE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\Core\HLE\sceNp.cpp">
|
||||
<Filter>HLE</Filter>
|
||||
</ClCompile>
|
||||
@@ -1528,6 +1531,9 @@
|
||||
<ClInclude Include="..\..\Core\HLE\sceNetAdhoc.h">
|
||||
<Filter>HLE</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\Core\HLE\sceNetAdhocMatching.h">
|
||||
<Filter>HLE</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\Core\HLE\sceNp.h">
|
||||
<Filter>HLE</Filter>
|
||||
</ClInclude>
|
||||
|
||||
@@ -708,6 +708,7 @@ EXEC_AND_LIB_FILES := \
|
||||
$(SRC)/Core/HLE/proAdhoc.cpp \
|
||||
$(SRC)/Core/HLE/proAdhocServer.cpp \
|
||||
$(SRC)/Core/HLE/sceNetAdhoc.cpp \
|
||||
$(SRC)/Core/HLE/sceNetAdhocMatching.cpp \
|
||||
$(SRC)/Core/HLE/sceOpenPSID.cpp \
|
||||
$(SRC)/Core/HLE/sceP3da.cpp \
|
||||
$(SRC)/Core/HLE/sceMt19937.cpp \
|
||||
|
||||
@@ -738,6 +738,7 @@ SOURCES_CXX += \
|
||||
$(COREDIR)/HLE/sceMpeg.cpp \
|
||||
$(COREDIR)/HLE/sceNet.cpp \
|
||||
$(COREDIR)/HLE/sceNetAdhoc.cpp \
|
||||
$(COREDIR)/HLE/sceNetAdhocMatching.cpp \
|
||||
$(COREDIR)/HLE/proAdhocServer.cpp \
|
||||
$(COREDIR)/HLE/proAdhoc.cpp \
|
||||
$(COREDIR)/HLE/sceOpenPSID.cpp \
|
||||
|
||||
Reference in new issue
Block a user