Add option to disable networking, tries to replicate the old error codes.

Please test if disabling this option "fixes" any games that broke with the adhoc merge.
This commit is contained in:
Henrik Rydgard 2013-12-04 11:07:00 +01:00
parent ce1693d7f9
commit 60ed75f68a
5 changed files with 127 additions and 20 deletions

View File

@ -310,6 +310,9 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
fAnalogStickX /= dp_xres; fAnalogStickX /= dp_xres;
fAnalogStickY /= dp_yres; fAnalogStickY /= dp_yres;
} }
IniFile::Section *network = iniFile.GetOrCreateSection("Network");
network->Get("EnableWlan", &bEnableWlan, true);
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam"); IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
#ifndef ANDROID #ifndef ANDROID
@ -546,6 +549,9 @@ void Config::Save() {
control->Set("AnalogStickY", fAnalogStickY); control->Set("AnalogStickY", fAnalogStickY);
control->Set("AnalogStickScale", fAnalogStickScale); control->Set("AnalogStickScale", fAnalogStickScale);
IniFile::Section *network = iniFile.GetOrCreateSection("Network");
network->Set("EnableWlan", &bEnableWlan, true);
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam"); IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
pspConfig->Set("PSPModel", iPSPModel); pspConfig->Set("PSPModel", iPSPModel);
pspConfig->Set("NickName", sNickName.c_str()); pspConfig->Set("NickName", sNickName.c_str());

View File

@ -72,6 +72,7 @@ public:
std::vector<std::string> recentIsos; std::vector<std::string> recentIsos;
std::string sLanguageIni; std::string sLanguageIni;
// GFX // GFX
bool bSoftwareRendering; bool bSoftwareRendering;
bool bHardwareTransform; // only used in the GLES backend bool bHardwareTransform; // only used in the GLES backend
@ -226,8 +227,12 @@ public:
int iButtonPreference; int iButtonPreference;
int iLockParentalLevel; int iLockParentalLevel;
bool bEncryptSave; bool bEncryptSave;
// Networking
bool bEnableWlan;
int iWlanAdhocChannel; int iWlanAdhocChannel;
bool bWlanPowerSave; bool bWlanPowerSave;
int iPSPModel; int iPSPModel;
// TODO: Make this work with your platform, too! // TODO: Make this work with your platform, too!
#ifdef _WIN32 #ifdef _WIN32

View File

@ -549,16 +549,17 @@ int initNetwork(SceNetAdhocctlAdhocId *adhoc_id){
if(iResult != 0){ if(iResult != 0){
ERROR_LOG(SCENET, "Dns error\n"); ERROR_LOG(SCENET, "Dns error\n");
return iResult; return iResult;
} }
for(ptr = resultAddr; ptr != NULL; ptr = ptr->ai_next){ for(ptr = resultAddr; ptr != NULL; ptr = ptr->ai_next){
switch(ptr->ai_family){ switch(ptr->ai_family){
case AF_INET: case AF_INET:
serverIp = ((sockaddr_in *)ptr->ai_addr)->sin_addr; serverIp = ((sockaddr_in *)ptr->ai_addr)->sin_addr;
} }
} }
server_addr.sin_addr = serverIp; iResult = connect(metasocket,(sockaddr *)&server_addr,sizeof(server_addr)); server_addr.sin_addr = serverIp;
if(iResult == SOCKET_ERROR){ iResult = connect(metasocket,(sockaddr *)&server_addr,sizeof(server_addr));
ERROR_LOG(SCENET,"Socket error"); if(iResult == SOCKET_ERROR){
ERROR_LOG(SCENET,"Socket error");
return iResult; return iResult;
} }
memset(&parameter,0,sizeof(parameter)); memset(&parameter,0,sizeof(parameter));

View File

@ -99,6 +99,8 @@ struct AdhocctlHandler {
static std::map<int, AdhocctlHandler> adhocctlHandlers; static std::map<int, AdhocctlHandler> adhocctlHandlers;
void __NetAdhocInit() { void __NetAdhocInit() {
friendFinderRunning = false;
eventHandlerUpdate = -1;
netAdhocInited = false; netAdhocInited = false;
netAdhocctlInited = false; netAdhocctlInited = false;
netAdhocMatchingInited = false; netAdhocMatchingInited = false;
@ -175,6 +177,11 @@ u32 sceNetAdhocctlInit(int stackSize, int prio, u32 productAddr) {
INFO_LOG(SCENET, "sceNetAdhocctlInit(%i, %i, %08x)", stackSize, prio, productAddr); INFO_LOG(SCENET, "sceNetAdhocctlInit(%i, %i, %08x)", stackSize, prio, productAddr);
if (netAdhocctlInited) { if (netAdhocctlInited) {
return ERROR_NET_ADHOCCTL_ALREADY_INITIALIZED; return ERROR_NET_ADHOCCTL_ALREADY_INITIALIZED;
} else if (!g_Config.bEnableWlan) {
// Pretend success but don't actually start the friendfinder thread and stuff.
// Dunno if this is the way to go...
netAdhocctlInited = true;
return 0;
} else if (initNetwork((SceNetAdhocctlAdhocId *)Memory::GetPointer(productAddr)) == 0) { } else if (initNetwork((SceNetAdhocctlAdhocId *)Memory::GetPointer(productAddr)) == 0) {
netAdhocctlInited = true; netAdhocctlInited = true;
eventHandlerUpdate = CoreTiming::RegisterEvent("HandlerUpdateEvent", __handlerUpdateCallback); eventHandlerUpdate = CoreTiming::RegisterEvent("HandlerUpdateEvent", __handlerUpdateCallback);
@ -193,7 +200,7 @@ int sceNetAdhocctlGetState(u32 ptrToStatus) {
// Valid Arguments // Valid Arguments
if(Memory::IsValidAddress(ptrToStatus)) { if(Memory::IsValidAddress(ptrToStatus)) {
// Return Thread Status // Return Thread Status
Memory::Write_U32(threadStatus,ptrToStatus); Memory::Write_U32(threadStatus, ptrToStatus);
// Return Success // Return Success
return 0; return 0;
} }
@ -216,6 +223,10 @@ int sceNetAdhocctlGetState(u32 ptrToStatus) {
*/ */
int sceNetAdhocPdpCreate(const char *mac, u32 port, int bufferSize, u32 unknown) { int sceNetAdhocPdpCreate(const char *mac, u32 port, int bufferSize, u32 unknown) {
INFO_LOG(SCENET, "sceNetAdhocPdpCreate(%s, %d, %d, %d)", mac, port, bufferSize, unknown); INFO_LOG(SCENET, "sceNetAdhocPdpCreate(%s, %d, %d, %d)", mac, port, bufferSize, unknown);
if (!g_Config.bEnableWlan) {
return -1;
}
// Library is initialized // Library is initialized
SceNetEtherAddr * saddr = (SceNetEtherAddr *)mac; SceNetEtherAddr * saddr = (SceNetEtherAddr *)mac;
if(netAdhocInited) { if(netAdhocInited) {
@ -305,6 +316,10 @@ int sceNetAdhocPdpCreate(const char *mac, u32 port, int bufferSize, u32 unknown)
*/ */
int sceNetAdhocctlGetParameter(u32 paramAddr) { int sceNetAdhocctlGetParameter(u32 paramAddr) {
INFO_LOG(SCENET, "sceNetAdhocctlGetParameter(%u)",paramAddr); INFO_LOG(SCENET, "sceNetAdhocctlGetParameter(%u)",paramAddr);
if (!g_Config.bEnableWlan) {
return ERROR_NET_ADHOCCTL_DISCONNECTED;
}
// Library initialized // Library initialized
if(netAdhocctlInited) { if(netAdhocctlInited) {
// Valid Arguments // Valid Arguments
@ -335,8 +350,15 @@ int sceNetAdhocctlGetParameter(u32 paramAddr) {
* @return 0 on success or... ADHOC_INVALID_ARG, ADHOC_NOT_INITIALIZED, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED, ADHOC_INVALID_ADDR, ADHOC_INVALID_PORT, ADHOC_INVALID_DATALEN, ADHOC_SOCKET_ALERTED, ADHOC_TIMEOUT, ADHOC_THREAD_ABORTED, ADHOC_WOULD_BLOCK, NET_NO_SPACE, NET_INTERNAL * @return 0 on success or... ADHOC_INVALID_ARG, ADHOC_NOT_INITIALIZED, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED, ADHOC_INVALID_ADDR, ADHOC_INVALID_PORT, ADHOC_INVALID_DATALEN, ADHOC_SOCKET_ALERTED, ADHOC_TIMEOUT, ADHOC_THREAD_ABORTED, ADHOC_WOULD_BLOCK, NET_NO_SPACE, NET_INTERNAL
*/ */
int sceNetAdhocPdpSend(int id, const char *mac, u32 port, void *data, int len, int timeout, int flag) { int sceNetAdhocPdpSend(int id, const char *mac, u32 port, void *data, int len, int timeout, int flag) {
INFO_LOG(SCENET, "sceNetAdhocPdpSend(%i, %s, %i, %p, %i, %i, %i)", id, mac, port, data, len, timeout, flag);
if (!g_Config.bEnableWlan) {
return -1;
}
SceNetEtherAddr * daddr = (SceNetEtherAddr *)mac; SceNetEtherAddr * daddr = (SceNetEtherAddr *)mac;
uint16 dport = (uint16 )port; uint16 dport = (uint16)port;
// Really should flatten this with early outs, all this indentation is making me dizzy.
// Library is initialized // Library is initialized
if(netAdhocInited) { if(netAdhocInited) {
// Valid Port // Valid Port
@ -481,6 +503,11 @@ int sceNetAdhocPdpSend(int id, const char *mac, u32 port, void *data, int len, i
* @return 0 on success or... ADHOC_INVALID_ARG, ADHOC_NOT_INITIALIZED, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED, ADHOC_SOCKET_ALERTED, ADHOC_WOULD_BLOCK, ADHOC_TIMEOUT, ADHOC_NOT_ENOUGH_SPACE, ADHOC_THREAD_ABORTED, NET_INTERNAL * @return 0 on success or... ADHOC_INVALID_ARG, ADHOC_NOT_INITIALIZED, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED, ADHOC_SOCKET_ALERTED, ADHOC_WOULD_BLOCK, ADHOC_TIMEOUT, ADHOC_NOT_ENOUGH_SPACE, ADHOC_THREAD_ABORTED, NET_INTERNAL
*/ */
int sceNetAdhocPdpRecv(int id, void *addr, void * port, void *buf, void *dataLength, u32 timeout, int flag) { int sceNetAdhocPdpRecv(int id, void *addr, void * port, void *buf, void *dataLength, u32 timeout, int flag) {
INFO_LOG(SCENET, "sceNetAdhocPdpRecv(%i, %p, %p, %p, %p, %i, %i)", id, addr, port, buf, dataLength, timeout, flag);
if (!g_Config.bEnableWlan) {
return -1;
}
SceNetEtherAddr *saddr = (SceNetEtherAddr *)addr; SceNetEtherAddr *saddr = (SceNetEtherAddr *)addr;
uint16_t * sport = (uint16_t *)port; uint16_t * sport = (uint16_t *)port;
int * len = (int *)dataLength; int * len = (int *)dataLength;
@ -598,6 +625,9 @@ int sceNetAdhocPollSocket(u32 socketStructAddr, int count, int timeout, int nonb
*/ */
int sceNetAdhocPdpDelete(int id, int unknown) { int sceNetAdhocPdpDelete(int id, int unknown) {
INFO_LOG(SCENET, "sceNetAdhocPdpDelete(%d, %d)", id, unknown); INFO_LOG(SCENET, "sceNetAdhocPdpDelete(%d, %d)", id, unknown);
if (!g_Config.bEnableWlan) {
return 0;
}
// Library is initialized // Library is initialized
if(netAdhocInited) { if(netAdhocInited) {
// Valid Arguments // Valid Arguments
@ -641,6 +671,7 @@ int sceNetAdhocctlGetAdhocId(u32 productStructAddr) {
} }
int sceNetAdhocctlScan() { int sceNetAdhocctlScan() {
INFO_LOG(SCENET, "sceNetAdhocctlScan()");
// Library initialized // Library initialized
if(netAdhocctlInited) { if(netAdhocctlInited) {
@ -667,6 +698,10 @@ int sceNetAdhocctlScan() {
} }
int sceNetAdhocctlGetScanInfo(u32 size, u32 bufAddr) { int sceNetAdhocctlGetScanInfo(u32 size, u32 bufAddr) {
INFO_LOG(SCENET, "sceNetAdhocctlGetScanInfo(%08x, %08x)", size, bufAddr);
if (!g_Config.bEnableWlan) {
return 0;
}
int * buflen = (int *)Memory::GetPointer(size); int * buflen = (int *)Memory::GetPointer(size);
SceNetAdhocctlScanInfo * buf = NULL; SceNetAdhocctlScanInfo * buf = NULL;
if(Memory::IsValidAddress(bufAddr)){ if(Memory::IsValidAddress(bufAddr)){
@ -783,6 +818,10 @@ u32 sceNetAdhocctlAddHandler(u32 handlerPtr, u32 handlerArg) {
} }
u32 sceNetAdhocctlDisconnect() { u32 sceNetAdhocctlDisconnect() {
INFO_LOG(SCENET, "sceNetAdhocctlDisconnect()");
if (!g_Config.bEnableWlan) {
return 0;
}
// Library initialized // Library initialized
if(netAdhocctlInited) { if(netAdhocctlInited) {
// Connected State (Adhoc Mode) // Connected State (Adhoc Mode)
@ -845,6 +884,10 @@ u32 sceNetAdhocctlDelHandler(u32 handlerID) {
int sceNetAdhocctlTerm() { int sceNetAdhocctlTerm() {
INFO_LOG(SCENET, "sceNetAdhocctlTerm()"); INFO_LOG(SCENET, "sceNetAdhocctlTerm()");
if (!g_Config.bEnableWlan) {
return 0;
}
if(netAdhocctlInited){ if(netAdhocctlInited){
netAdhocctlInited = false; netAdhocctlInited = false;
friendFinderRunning = false; friendFinderRunning = false;
@ -884,6 +927,10 @@ int sceNetAdhocctlGetPeerInfo(const char *mac, int size, u32 peerInfoAddr) {
*/ */
int sceNetAdhocctlCreate(const char *groupName) { int sceNetAdhocctlCreate(const char *groupName) {
INFO_LOG(SCENET, "sceNetAdhocctlCreate(%s)", groupName); INFO_LOG(SCENET, "sceNetAdhocctlCreate(%s)", groupName);
if (!g_Config.bEnableWlan) {
return -1;
}
const SceNetAdhocctlGroupName * groupNameStruct = (const SceNetAdhocctlGroupName *)groupName; const SceNetAdhocctlGroupName * groupNameStruct = (const SceNetAdhocctlGroupName *)groupName;
// Library initialized // Library initialized
if(netAdhocctlInited) { if(netAdhocctlInited) {
@ -955,6 +1002,10 @@ int sceNetAdhocctlJoinEnterGameMode(const char *groupName, const char *macAddr,
int sceNetAdhocTerm() { int sceNetAdhocTerm() {
INFO_LOG(SCENET, "sceNetAdhocTerm()"); INFO_LOG(SCENET, "sceNetAdhocTerm()");
if (!g_Config.bEnableWlan) {
return 0;
}
// Library is initialized // Library is initialized
if(netAdhocInited) { if(netAdhocInited) {
// Delete PDP Sockets // Delete PDP Sockets
@ -993,8 +1044,13 @@ int sceNetAdhocGetPdpStat(int structSize, u32 structAddr) {
* @return 0 on success or... ADHOC_INVALID_ARG, ADHOC_NOT_INITIALIZED * @return 0 on success or... ADHOC_INVALID_ARG, ADHOC_NOT_INITIALIZED
*/ */
int sceNetAdhocGetPtpStat(u32 structSize, u32 structAddr) { int sceNetAdhocGetPtpStat(u32 structSize, u32 structAddr) {
// INFO_LOG(SCENET,"sceNetAdhocGetPtpStat(%u,%u)",structSize,structAddr);
// Spams a lot // Spams a lot
VERBOSE_LOG(SCENET,"sceNetAdhocGetPtpStat(%u,%u)",structSize,structAddr);
if (!g_Config.bEnableWlan) {
return 0;
}
int * buflen = (int *)Memory::GetPointer(structSize); int * buflen = (int *)Memory::GetPointer(structSize);
// Library is initialized // Library is initialized
if(netAdhocInited) { if(netAdhocInited) {
@ -1072,6 +1128,9 @@ int sceNetAdhocGetPtpStat(u32 structSize, u32 structAddr) {
*/ */
int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac, int dport, int bufsize, int rexmt_int, int rexmt_cnt, int unknown) { int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac, int dport, int bufsize, int rexmt_int, int rexmt_cnt, int unknown) {
INFO_LOG(SCENET, "sceNetAdhocPtpOpen(%s,%d,%s,%d,%d,%d,%d,%d)", srcmac, sport, dstmac,dport,bufsize, rexmt_int, rexmt_cnt, unknown); INFO_LOG(SCENET, "sceNetAdhocPtpOpen(%s,%d,%s,%d,%d,%d,%d,%d)", srcmac, sport, dstmac,dport,bufsize, rexmt_int, rexmt_cnt, unknown);
if (!g_Config.bEnableWlan) {
return 0;
}
SceNetEtherAddr * saddr = (SceNetEtherAddr *)srcmac; SceNetEtherAddr * saddr = (SceNetEtherAddr *)srcmac;
SceNetEtherAddr * daddr = (SceNetEtherAddr *)dstmac; SceNetEtherAddr * daddr = (SceNetEtherAddr *)dstmac;
// Library is initialized // Library is initialized
@ -1180,15 +1239,20 @@ int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac, int dp
* @return Socket ID >= 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED, ADHOC_SOCKET_ALERTED, ADHOC_SOCKET_ID_NOT_AVAIL, ADHOC_WOULD_BLOCK, ADHOC_TIMEOUT, ADHOC_NOT_LISTENED, ADHOC_THREAD_ABORTED, NET_INTERNAL * @return Socket ID >= 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED, ADHOC_SOCKET_ALERTED, ADHOC_SOCKET_ID_NOT_AVAIL, ADHOC_WOULD_BLOCK, ADHOC_TIMEOUT, ADHOC_NOT_LISTENED, ADHOC_THREAD_ABORTED, NET_INTERNAL
*/ */
int sceNetAdhocPtpAccept(int id, u32 peerMacAddrPtr, u32 peerPortPtr, int timeout, int flag) { int sceNetAdhocPtpAccept(int id, u32 peerMacAddrPtr, u32 peerPortPtr, int timeout, int flag) {
SceNetEtherAddr * addr = NULL; SceNetEtherAddr * addr = NULL;
if(Memory::IsValidAddress(peerMacAddrPtr)){ if(Memory::IsValidAddress(peerMacAddrPtr)){
addr = Memory::GetStruct<SceNetEtherAddr>(peerMacAddrPtr); addr = Memory::GetStruct<SceNetEtherAddr>(peerMacAddrPtr);
} }
uint16_t * port = NULL; uint16_t * port = NULL;
if(Memory::IsValidAddress(peerPortPtr)){ if(Memory::IsValidAddress(peerPortPtr)){
port = (uint16_t *)Memory::GetPointer(peerPortPtr); port = (uint16_t *)Memory::GetPointer(peerPortPtr);
} }
INFO_LOG(SCENET, "sceNetAdhocPtpAccept(%d,%s,%d,%u,%d)",id, addr->data,*port,timeout, flag); INFO_LOG(SCENET, "sceNetAdhocPtpAccept(%d,%s,%d,%u,%d)",id, addr->data,*port,timeout, flag);
if (!g_Config.bEnableWlan) {
return 0;
}
// Library is initialized // Library is initialized
if(netAdhocInited) { if(netAdhocInited) {
// Valid Socket // Valid Socket
@ -1336,6 +1400,11 @@ int sceNetAdhocPtpAccept(int id, u32 peerMacAddrPtr, u32 peerPortPtr, int timeou
* @return 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED, ADHOC_CONNECTION_REFUSED, ADHOC_SOCKET_ALERTED, ADHOC_WOULD_BLOCK, ADHOC_TIMEOUT, ADHOC_NOT_OPENED, ADHOC_THREAD_ABORTED, NET_INTERNAL * @return 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED, ADHOC_CONNECTION_REFUSED, ADHOC_SOCKET_ALERTED, ADHOC_WOULD_BLOCK, ADHOC_TIMEOUT, ADHOC_NOT_OPENED, ADHOC_THREAD_ABORTED, NET_INTERNAL
*/ */
int sceNetAdhocPtpConnect(int id, int timeout, int flag) { int sceNetAdhocPtpConnect(int id, int timeout, int flag) {
INFO_LOG(SCENET, "sceNetAdhocPtpConnect(%i, %i, %08x)", id, timeout, flag);
if (!g_Config.bEnableWlan) {
return 0;
}
// Library is initialized // Library is initialized
if(netAdhocInited) if(netAdhocInited)
{ {
@ -1446,6 +1515,9 @@ int sceNetAdhocPtpConnect(int id, int timeout, int flag) {
*/ */
int sceNetAdhocPtpClose(int id, int unknown) { int sceNetAdhocPtpClose(int id, int unknown) {
INFO_LOG(SCENET,"sceNetAdhocPtpClose(%d,%d)",id,unknown); INFO_LOG(SCENET,"sceNetAdhocPtpClose(%d,%d)",id,unknown);
if (!g_Config.bEnableWlan) {
return 0;
}
// Library is initialized // Library is initialized
if(netAdhocInited) { if(netAdhocInited) {
// Valid Arguments & Atleast one Socket // Valid Arguments & Atleast one Socket
@ -1490,8 +1562,10 @@ int sceNetAdhocPtpClose(int id, int unknown) {
* @return Socket ID > 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_ADDR, ADHOC_INVALID_PORT, ADHOC_SOCKET_ID_NOT_AVAIL, ADHOC_PORT_NOT_AVAIL, ADHOC_PORT_IN_USE, NET_NO_SPACE * @return Socket ID > 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_ADDR, ADHOC_INVALID_PORT, ADHOC_SOCKET_ID_NOT_AVAIL, ADHOC_PORT_NOT_AVAIL, ADHOC_PORT_IN_USE, NET_NO_SPACE
*/ */
int sceNetAdhocPtpListen(const char *srcmac, int sport, int bufsize, int rexmt_int, int rexmt_cnt, int backlog, int unk) { int sceNetAdhocPtpListen(const char *srcmac, int sport, int bufsize, int rexmt_int, int rexmt_cnt, int backlog, int unk) {
INFO_LOG(SCENET, "sceNetAdhocPtpListen(%s,%d,%d,%d,%d,%d,%d)", INFO_LOG(SCENET, "sceNetAdhocPtpListen(%s,%d,%d,%d,%d,%d,%d)",srcmac,sport,bufsize,rexmt_int,rexmt_cnt,backlog,unk);
srcmac,sport,bufsize,rexmt_int,rexmt_cnt,backlog,unk); if (!g_Config.bEnableWlan) {
return 0;
}
// Library is initialized // Library is initialized
SceNetEtherAddr * saddr = (SceNetEtherAddr *)srcmac; SceNetEtherAddr * saddr = (SceNetEtherAddr *)srcmac;
if(netAdhocInited) { if(netAdhocInited) {
@ -1607,6 +1681,10 @@ int sceNetAdhocPtpListen(const char *srcmac, int sport, int bufsize, int rexmt_i
* @return 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED, ADHOC_SOCKET_ALERTED, ADHOC_WOULD_BLOCK, ADHOC_TIMEOUT, ADHOC_NOT_CONNECTED, ADHOC_THREAD_ABORTED, ADHOC_INVALID_DATALEN, ADHOC_DISCONNECTED, NET_INTERNAL, NET_NO_SPACE * @return 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED, ADHOC_SOCKET_ALERTED, ADHOC_WOULD_BLOCK, ADHOC_TIMEOUT, ADHOC_NOT_CONNECTED, ADHOC_THREAD_ABORTED, ADHOC_INVALID_DATALEN, ADHOC_DISCONNECTED, NET_INTERNAL, NET_NO_SPACE
*/ */
int sceNetAdhocPtpSend(int id, u32 dataAddr, u32 dataSizeAddr, int timeout, int flag) { int sceNetAdhocPtpSend(int id, u32 dataAddr, u32 dataSizeAddr, int timeout, int flag) {
INFO_LOG(SCENET, "sceNetAdhocPtpSend(%d,%08x,%08x,%d,%d)", id, dataAddr, dataSizeAddr, timeout, flag);
if (!g_Config.bEnableWlan) {
return 0;
}
int * len = (int *)Memory::GetPointer(dataSizeAddr); int * len = (int *)Memory::GetPointer(dataSizeAddr);
const char * data = Memory::GetCharPointer(dataAddr); const char * data = Memory::GetCharPointer(dataAddr);
// Library is initialized // Library is initialized
@ -1689,8 +1767,12 @@ int sceNetAdhocPtpSend(int id, u32 dataAddr, u32 dataSizeAddr, int timeout, int
* @param flag Nonblocking Flag * @param flag Nonblocking Flag
* @return 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED, ADHOC_SOCKET_ALERTED, ADHOC_WOULD_BLOCK, ADHOC_TIMEOUT, ADHOC_THREAD_ABORTED, ADHOC_DISCONNECTED, NET_INTERNAL * @return 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED, ADHOC_SOCKET_ALERTED, ADHOC_WOULD_BLOCK, ADHOC_TIMEOUT, ADHOC_THREAD_ABORTED, ADHOC_DISCONNECTED, NET_INTERNAL
*/ */
int sceNetAdhocPtpRecv(int id, u32 data, u32 dataSizeAddr, int timeout, int flag) { int sceNetAdhocPtpRecv(int id, u32 dataAddr, u32 dataSizeAddr, int timeout, int flag) {
void * buf = (void *)Memory::GetPointer(data); INFO_LOG(SCENET, "sceNetAdhocPtpRecv(%d,%08x,%08x,%d,%d)", id, dataAddr, dataSizeAddr, timeout, flag);
if (!g_Config.bEnableWlan) {
return 0;
}
void * buf = (void *)Memory::GetPointer(dataAddr);
int * len = (int *)Memory::GetPointer(dataSizeAddr); int * len = (int *)Memory::GetPointer(dataSizeAddr);
// Library is initialized // Library is initialized
if(netAdhocInited) { if(netAdhocInited) {
@ -1765,6 +1847,10 @@ int sceNetAdhocPtpRecv(int id, u32 data, u32 dataSizeAddr, int timeout, int flag
*/ */
int sceNetAdhocPtpFlush(int id, int timeout, int nonblock) { int sceNetAdhocPtpFlush(int id, int timeout, int nonblock) {
INFO_LOG(SCENET,"sceNetAdhocPtpFlush(%d,%d,%d)", id, timeout, nonblock); INFO_LOG(SCENET,"sceNetAdhocPtpFlush(%d,%d,%d)", id, timeout, nonblock);
if (!g_Config.bEnableWlan) {
return 0;
}
// Library initialized // Library initialized
if(netAdhocInited) { if(netAdhocInited) {
// Valid Socket // Valid Socket
@ -1843,6 +1929,10 @@ int sceNetAdhocMatchingTerm() {
// Presumably returns a "matchingId". // Presumably returns a "matchingId".
int sceNetAdhocMatchingCreate(int mode, int maxnum, int port, int rxbuflen, int hello_int, int keepalive_int, int init_count, int rexmt_int, u32 callbackAddr) { int sceNetAdhocMatchingCreate(int mode, int maxnum, int port, int rxbuflen, int hello_int, int keepalive_int, int init_count, int rexmt_int, u32 callbackAddr) {
INFO_LOG(SCENET, "sceNetAdhocMatchingCreate"); INFO_LOG(SCENET, "sceNetAdhocMatchingCreate");
if (!g_Config.bEnableWlan) {
return -1;
}
SceNetAdhocMatchingHandler handler; SceNetAdhocMatchingHandler handler;
handler.entryPoint = callbackAddr; handler.entryPoint = callbackAddr;
@ -2064,9 +2154,14 @@ int sceNetAdhocctlGetGameModeInfo(u32 infoAddr) {
int sceNetAdhocctlGetPeerList(u32 sizeAddr, u32 bufAddr) { int sceNetAdhocctlGetPeerList(u32 sizeAddr, u32 bufAddr) {
INFO_LOG(SCENET, "sceNetAdhocctlGetPeerList(%08x, %08x)", sizeAddr, bufAddr);
if (!g_Config.bEnableWlan) {
return -1;
}
int * buflen = (int *)Memory::GetPointer(sizeAddr); int * buflen = (int *)Memory::GetPointer(sizeAddr);
SceNetAdhocctlPeerInfoEmu * buf = NULL; SceNetAdhocctlPeerInfoEmu * buf = NULL;
if(Memory::IsValidAddress(bufAddr)){ if (Memory::IsValidAddress(bufAddr)){
buf = (SceNetAdhocctlPeerInfoEmu *)Memory::GetPointer(bufAddr); buf = (SceNetAdhocctlPeerInfoEmu *)Memory::GetPointer(bufAddr);
} }
// Initialized Library // Initialized Library

View File

@ -267,7 +267,7 @@ void GameSettingsScreen::CreateViews() {
systemSettings->Add(new CheckBox(&g_Config.bAtomicAudioLocks, s->T("Atomic Audio locks (experimental)")))->SetEnabled(!PSP_IsInited()); systemSettings->Add(new CheckBox(&g_Config.bAtomicAudioLocks, s->T("Atomic Audio locks (experimental)")))->SetEnabled(!PSP_IsInited());
systemSettings->Add(new ItemHeader(s->T("Networking"))); systemSettings->Add(new ItemHeader(s->T("Networking")));
systemSettings->Add(new CheckBox(&g_Config.bFastMemory, s->T("Fast Memory", "Fast Memory (Unstable)"))); systemSettings->Add(new CheckBox(&g_Config.bEnableWlan, s->T("Networking", "Enable networking/wlan (beta)")));
enableReports_ = Reporting::IsEnabled(); enableReports_ = Reporting::IsEnabled();
//#ifndef ANDROID //#ifndef ANDROID