From b8e0fc8fa712a228218a5b7dcdaa0fd06249c327 Mon Sep 17 00:00:00 2001 From: sum2012 Date: Sun, 25 May 2014 07:57:02 +0800 Subject: [PATCH 1/2] Small improve of sceNetAdhocMatching* Now Metal Slug XX can display online screen. --- Core/HLE/sceNetAdhoc.cpp | 52 ++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index 5d654e7aa4..2531e46b20 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -2049,67 +2049,93 @@ int sceNetAdhocMatchingCreate(int mode, int maxnum, int port, int rxbuflen, int int sceNetAdhocMatchingStart(int matchingId, int evthPri, int evthStack, int inthPri, int inthStack, int optLen, u32 optDataAddr) { ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingStart(%i, %i, %i, %i, %i, %i, %08x)", matchingId, evthPri, evthStack, inthPri, inthStack, optLen, optDataAddr); - return -1; + if (!g_Config.bEnableWlan) + return -1; + return 0; } int sceNetAdhocMatchingStop(int matchingId) { ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingStop(%i)", matchingId); - return -1; + if (!g_Config.bEnableWlan) + return -1; + return 0; } int sceNetAdhocMatchingDelete(int matchingId) { ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingDelete(%i)", matchingId); - return -1; + if (!g_Config.bEnableWlan) + return -1; + return 0; } int sceNetAdhocMatchingSelectTarget(int matchingId, const char *macAddress, int optLen, u32 optDataPtr) { ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingSelectTarget(%i, %s, %i, %08x)", matchingId, macAddress, optLen, optDataPtr); - return -1; + if (!g_Config.bEnableWlan) + return -1; + return 0; } int sceNetAdhocMatchingCancelTargetWithOpt(int matchingId, const char *macAddress, int optLen, u32 optDataPtr) { ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingCancelTargetWithOpt(%i, %s, %i, %08x)", matchingId, macAddress, optLen, optDataPtr); - return -1; + if (!g_Config.bEnableWlan) + return -1; + return 0; } int sceNetAdhocMatchingCancelTarget(int matchingId, const char *macAddress) { ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingCancelTarget(%i, %s)", matchingId, macAddress); - return -1; + if (!g_Config.bEnableWlan) + return -1; + return 0; } int sceNetAdhocMatchingGetHelloOpt(int matchingId, u32 optLenAddr, u32 optDataAddr) { ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingGetHelloOpt(%i, %08x, %08x)", matchingId, optLenAddr, optDataAddr); - return -1; + if (!g_Config.bEnableWlan) + return -1; + return 0; } int sceNetAdhocMatchingSetHelloOpt(int matchingId, int optLenAddr, u32 optDataAddr) { ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingSetHelloOpt(%i, %i, %08x)", matchingId, optLenAddr, optDataAddr); - return -1; + if (!g_Config.bEnableWlan) + return -1; + return 0; } int sceNetAdhocMatchingGetMembers(int matchingId, u32 sizeAddr, u32 buf) { ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingGetMembers(%i, %08x, %08x)", matchingId, sizeAddr, buf); - return -1; + if (!g_Config.bEnableWlan) + return -1; + return 0; } int sceNetAdhocMatchingSendData(int matchingId, const char *mac, int dataLen, u32 dataAddr) { ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingSendData(%i, %s, %i, %08x)", matchingId, mac, dataLen, dataAddr); - return -1; + if (!g_Config.bEnableWlan) + return -1; + return 0; } int sceNetAdhocMatchingAbortSendData(int matchingId, const char *mac) { ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingAbortSendData(%i, %s)", matchingId, mac); - return -1; + if (!g_Config.bEnableWlan) + return -1; + return 0; } int sceNetAdhocMatchingGetPoolMaxAlloc() { ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingGetPoolMaxAlloc()"); - return -1; + if (!g_Config.bEnableWlan) + return -1; + return 0; } int sceNetAdhocMatchingGetPoolStat() { ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingGetPoolStat()"); - return -1; + if (!g_Config.bEnableWlan) + return -1; + return 0; } const HLEFunction sceNetAdhoc[] = { From 1d36836d2d70a7026c900a9004fcb1705ccd6aea Mon Sep 17 00:00:00 2001 From: sum2012 Date: Sun, 25 May 2014 10:51:00 +0800 Subject: [PATCH 2/2] Add some constant --- Core/HLE/sceNetAdhoc.cpp | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index 2531e46b20..afb315d064 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -89,6 +89,51 @@ enum { PSP_ADHOC_POLL_CAN_ACCEPT = 8, }; +enum { +/** +* Matching events used in pspAdhocMatchingCallback +*/ + /** Hello event. optdata contains data if optlen > 0. */ + PSP_ADHOC_MATCHING_EVENT_HELLO = 1, + /** Join request. optdata contains data if optlen > 0. */ + PSP_ADHOC_MATCHING_EVENT_JOIN = 2, + /** Target left matching. */ + PSP_ADHOC_MATCHING_EVENT_LEFT = 3, + /** Join request rejected. */ + PSP_ADHOC_MATCHING_EVENT_REJECT = 4, + /** Join request cancelled. */ + PSP_ADHOC_MATCHING_EVENT_CANCEL = 5, + /** Join request accepted. optdata contains data if optlen > 0. */ + PSP_ADHOC_MATCHING_EVENT_ACCEPT = 6, + /** Matching is complete. */ + PSP_ADHOC_MATCHING_EVENT_COMPLETE = 7, + /** Ping timeout event. */ + PSP_ADHOC_MATCHING_EVENT_TIMEOUT = 8, + /** Error event. */ + PSP_ADHOC_MATCHING_EVENT_ERROR = 9, + /** Peer disconnect event. */ + PSP_ADHOC_MATCHING_EVENT_DISCONNECT = 10, + /** Data received event. optdata contains data if optlen > 0. */ + PSP_ADHOC_MATCHING_EVENT_DATA = 11, + /** Data acknowledged event. */ + PSP_ADHOC_MATCHING_EVENT_DATA_CONFIRM = 12, + /** Data timeout event. */ + PSP_ADHOC_MATCHING_EVENT_DATA_TIMEOUT = 13, + + /** Internal ping message. */ + PSP_ADHOC_MATCHING_EVENT_INTERNAL_PING = 100, + + /** + * Matching modes used in sceNetAdhocMatchingCreate + */ + /** Host */ + PSP_ADHOC_MATCHING_MODE_HOST = 1, + /** Client */ + PSP_ADHOC_MATCHING_MODE_CLIENT = 2, + /** Peer to peer */ + PSP_ADHOC_MATCHING_MODE_PTP = 3, +}; + const size_t MAX_ADHOCCTL_HANDLERS = 32; static bool netAdhocInited;