mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-27 12:05:43 +00:00
Show some major networking errors on the OSD
This commit is contained in:
parent
70c745ca27
commit
d479fae481
@ -27,6 +27,7 @@
|
||||
#include "Core/HLE/sceKernelInterrupt.h"
|
||||
#include "Core/HLE/sceKernelThread.h"
|
||||
#include "Core/HLE/sceKernelMemory.h"
|
||||
#include "UI/OnScreenDisplay.h"
|
||||
#include "proAdhoc.h"
|
||||
|
||||
uint32_t fakePoolSize = 0;
|
||||
@ -1425,6 +1426,7 @@ int initNetwork(SceNetAdhocctlAdhocId *adhoc_id){
|
||||
iResult = getaddrinfo(g_Config.proAdhocServer.c_str(),0,NULL,&resultAddr);
|
||||
if (iResult != 0) {
|
||||
ERROR_LOG(SCENET, "DNS Error (%s)\n", g_Config.proAdhocServer.c_str());
|
||||
osm.Show("DNS Error connecting to " + g_Config.proAdhocServer, 8.0f);
|
||||
return iResult;
|
||||
}
|
||||
for (ptr = resultAddr; ptr != NULL; ptr = ptr->ai_next) {
|
||||
@ -1444,7 +1446,10 @@ int initNetwork(SceNetAdhocctlAdhocId *adhoc_id){
|
||||
iResult = connect(metasocket,(sockaddr *)&server_addr,sizeof(server_addr));
|
||||
if (iResult == SOCKET_ERROR) {
|
||||
uint8_t * sip = (uint8_t *)&server_addr.sin_addr.s_addr;
|
||||
ERROR_LOG(SCENET, "Socket error (%i) when connecting to %s/%u.%u.%u.%u:%u", errno, g_Config.proAdhocServer.c_str(), sip[0], sip[1], sip[2], sip[3], ntohs(server_addr.sin_port));
|
||||
char buffer[512];
|
||||
snprintf(buffer, sizeof(buffer), "Socket error (%i) when connecting to %s/%u.%u.%u.%u:%u", errno, g_Config.proAdhocServer.c_str(), sip[0], sip[1], sip[2], sip[3], ntohs(server_addr.sin_port));
|
||||
ERROR_LOG(SCENET, "%s", buffer);
|
||||
osm.Show(std::string(buffer), 8.0f);
|
||||
return iResult;
|
||||
}
|
||||
|
||||
@ -1459,6 +1464,7 @@ int initNetwork(SceNetAdhocctlAdhocId *adhoc_id){
|
||||
int sent = send(metasocket, (char*)&packet, sizeof(packet), 0);
|
||||
changeBlockingMode(metasocket, 1); // Change to non-blocking
|
||||
if (sent > 0){
|
||||
osm.Show("Network Initialized", 1.0);
|
||||
return 0;
|
||||
}
|
||||
else{
|
||||
|
@ -104,7 +104,7 @@ static u32 sceNetTerm() {
|
||||
if (netAdhocctlInited) sceNetAdhocctlTerm();
|
||||
if (netAdhocInited) sceNetAdhocTerm();
|
||||
|
||||
WARN_LOG(SCENET, "UNTESTED sceNetTerm()");
|
||||
WARN_LOG(SCENET, "sceNetTerm()");
|
||||
netInited = false;
|
||||
|
||||
return 0;
|
||||
@ -113,9 +113,10 @@ static u32 sceNetTerm() {
|
||||
// TODO: should that struct actually be initialized here?
|
||||
static u32 sceNetInit(u32 poolSize, u32 calloutPri, u32 calloutStack, u32 netinitPri, u32 netinitStack) {
|
||||
// May need to Terminate old one first since the game (ie. GTA:VCS) might not called sceNetTerm before the next sceNetInit and behave strangely
|
||||
if (netInited) sceNetTerm();
|
||||
if (netInited)
|
||||
sceNetTerm();
|
||||
|
||||
ERROR_LOG(SCENET, "UNTESTED sceNetInit(poolsize=%d, calloutpri=%i, calloutstack=%d, netintrpri=%i, netintrstack=%d) at %08x", poolSize, calloutPri, calloutStack, netinitPri, netinitStack, currentMIPS->pc);
|
||||
WARN_LOG(SCENET, "sceNetInit(poolsize=%d, calloutpri=%i, calloutstack=%d, netintrpri=%i, netintrstack=%d) at %08x", poolSize, calloutPri, calloutStack, netinitPri, netinitStack, currentMIPS->pc);
|
||||
netInited = true;
|
||||
netMallocStat.maximum = poolSize;
|
||||
netMallocStat.free = poolSize;
|
||||
|
@ -193,7 +193,6 @@ void __NetAdhocInit() {
|
||||
eventMatchingHandlerUpdate = CoreTiming::RegisterEvent("MatchingHandlerUpdateEvent", __handlerMatchingUpdateCallback);
|
||||
// Create built-in AdhocServer Thread
|
||||
if (g_Config.bEnableWlan && g_Config.bEnableAdhocServer) {
|
||||
//_status = 1;
|
||||
adhocServerRunning = true;
|
||||
adhocServerThread = std::thread(proAdhocServerThread, SERVER_PORT);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user