diff --git a/core/networking/networking.h b/core/networking/networking.h index d67a51d..bf32119 100644 --- a/core/networking/networking.h +++ b/core/networking/networking.h @@ -43,7 +43,8 @@ class INetworking { * @param info * @return int32_t */ - virtual int32_t netCtlGetInfo(int code, SceNetCtlInfo* info) = 0; + virtual int32_t netCtlGetInfo(int32_t code, SceNetCtlInfo* info) = 0; + virtual int32_t netCtlGetState(int32_t* state) = 0; /* SceNet facility */ diff --git a/core/networking/states/offline.cpp b/core/networking/states/offline.cpp index 1e47c9e..f660936 100644 --- a/core/networking/states/offline.cpp +++ b/core/networking/states/offline.cpp @@ -36,6 +36,11 @@ int32_t OfflineNet::netCtlGetInfo(int32_t code, SceNetCtlInfo* info) { return Err::NetCtl::NOT_CONNECTED; } +int32_t OfflineNet::netCtlGetState(int32_t* state) { + *state = 0; // IP address obtained + return Ok; +} + SceNetId OfflineNet::resolverCreate(const char* name, int memid, int flags) { static SceNetId id = 0; return ++id; diff --git a/core/networking/states/offline.h b/core/networking/states/offline.h index 8a7df00..cbd0d50 100644 --- a/core/networking/states/offline.h +++ b/core/networking/states/offline.h @@ -13,6 +13,7 @@ class OfflineNet: public INetworking { * @return int32_t */ int32_t netCtlGetInfo(int32_t code, SceNetCtlInfo* info) final; + int32_t netCtlGetState(int32_t* state) final; /* SceNet facility */ diff --git a/core/networking/states/online.h b/core/networking/states/online.h index 2d4f319..0c4915b 100644 --- a/core/networking/states/online.h +++ b/core/networking/states/online.h @@ -17,6 +17,7 @@ class OnlineNet: public INetworking { * @return int32_t */ int32_t netCtlGetInfo(int32_t code, SceNetCtlInfo* info) final; + int32_t netCtlGetState(int32_t* state) final; /* SceNet facility */ diff --git a/core/networking/states/online/netctl.cpp b/core/networking/states/online/netctl.cpp index cd48070..4ac3b2f 100644 --- a/core/networking/states/online/netctl.cpp +++ b/core/networking/states/online/netctl.cpp @@ -189,3 +189,8 @@ int32_t OnlineNet::netCtlGetInfo(int32_t code, SceNetCtlInfo* info) { return Ok; } + +int32_t OnlineNet::netCtlGetState(int32_t* state) { + *state = 3; // IP address obtained + return Ok; +} diff --git a/modules/libSceNetCtl/entry.cpp b/modules/libSceNetCtl/entry.cpp index 2eabca9..ed7fb44 100644 --- a/modules/libSceNetCtl/entry.cpp +++ b/modules/libSceNetCtl/entry.cpp @@ -35,8 +35,7 @@ EXPORT SYSV_ABI int sceNetCtlGetResult(int eventType, int* errorCode) { } EXPORT SYSV_ABI int sceNetCtlGetState(int* state) { - *state = 3; // IP address obtained - return Ok; + return accessNetworking().netCtlGetState(state); } EXPORT SYSV_ABI int sceNetCtlGetInfo(int code, SceNetCtlInfo* info) {