[Scummvm-git-logs] scummvm master -> fb3a63c78c45c728fb68d23b5f1479364b437819

aquadran noreply at scummvm.org
Sun Feb 6 20:20:55 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
fb3a63c78c PS3: Implemented getting IP address for local web server


Commit: fb3a63c78c45c728fb68d23b5f1479364b437819
    https://github.com/scummvm/scummvm/commit/fb3a63c78c45c728fb68d23b5f1479364b437819
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2022-02-06T21:20:49+01:00

Commit Message:
PS3: Implemented getting IP address for local web server

Changed paths:
    backends/networking/sdl_net/localwebserver.cpp
    configure


diff --git a/backends/networking/sdl_net/localwebserver.cpp b/backends/networking/sdl_net/localwebserver.cpp
index 8b4d6bda8d8..eef3d5573f5 100644
--- a/backends/networking/sdl_net/localwebserver.cpp
+++ b/backends/networking/sdl_net/localwebserver.cpp
@@ -50,6 +50,10 @@
 #endif
 
 #define LSSDP_BUFFER_LEN 2048
+#endif // POSIX
+
+#ifdef PLAYSTATION3
+#include <net/netctl.h>
 #endif
 
 namespace Common {
@@ -321,7 +325,7 @@ void LocalWebserver::resolveAddress(void *ipAddress) {
 		ifc.ifc_buf = (caddr_t) buffer;
 
 		if (ioctl(fd, SIOCGIFCONF, &ifc) < 0) {
-		    warning("LocalWebserver: ioctl SIOCGIFCONF failed: %s (%d)", strerror(errno), errno);
+			warning("LocalWebserver: ioctl SIOCGIFCONF failed: %s (%d)", strerror(errno), errno);
 		} else {
 			struct ifreq *i;
 			for (size_t index = 0; index < (size_t)ifc.ifc_len; index += _SIZEOF_ADDR_IFREQ(*i)) {
@@ -372,6 +376,22 @@ void LocalWebserver::resolveAddress(void *ipAddress) {
 			warning("LocalWebserver: failed to close socket [fd %d]: %s (%d)", fd, strerror(errno), errno);
 		}
 	}
+#elif defined(PLAYSTATION3)
+	netCtlInit();
+	s32 connectionState;
+	netCtlGetState(&connectionState);
+	if (connectionState == NET_CTL_STATE_IPObtained) {
+		union net_ctl_info info;
+		if (netCtlGetInfo(NET_CTL_INFO_IP_ADDRESS, &info) == 0) {
+			debug(9, "LocalWebserver: IP Address %s", info.ip_address);
+			_address = "http://" + Common::String(info.ip_address) + Common::String::format(":%u/", _serverPort);
+		} else {
+			warning("LocalWebserver: failed to get IP address for network connection");
+		}
+	} else {
+		warning("LocalWebserver: no active network connection was detected");
+	}
+	netCtlTerm();
 #endif
 }
 
diff --git a/configure b/configure
index 8aad4338e86..2d37fc0bcc1 100755
--- a/configure
+++ b/configure
@@ -3024,7 +3024,7 @@ EOF
 		append_var CXXFLAGS "-mcpu=cell -mno-fp-in-toc -I$PSL1GHT/ppu/include -I$PS3DEV/portlibs/ppu/include"
 		append_var LDFLAGS "-L$PSL1GHT/ppu/lib -L$PS3DEV/portlibs/ppu/lib"
 		# The network libraries are statically linked and need to be specified in the following order
-		append_var SDL_NET_LIBS "-lSDL_net -lnet -lsysmodule"
+		append_var SDL_NET_LIBS "-lSDL2_net -lnet -lnetctl -lsysmodule"
 		add_line_to_config_mk 'PLAYSTATION3 = 1'
 		add_line_to_config_h "#define PREFIX \"${prefix}\""
 		# PS3 has no OpenGL support at all even though it's SDL based




More information about the Scummvm-git-logs mailing list