diff --git a/Makefile.ps5 b/Makefile.ps5
index 9c09c43..6ff034e 100644
--- a/Makefile.ps5
+++ b/Makefile.ps5
@@ -29,7 +29,7 @@ PYTHON ?= python3
BIN := websrv.elf
SRCS := src/main.c src/websrv.c src/asset.c src/fs.c
-SRCS += src/ps5/sys.c src/ps5/pt.c src/ps5/elfldr.c src/ps5/hbldr.c
+SRCS += src/ps5/sys.c src/ps5/pt.c src/ps5/elfldr.c src/ps5/hbldr.c src/ps5/notify.c
CFLAGS := -Wall -Werror -Isrc -DVERSION_TAG=\"$(VERSION_TAG)\"
LDADD := -lkernel_sys -lmicrohttpd -lSceSystemService -lSceUserService
diff --git a/src/ps5/notify.c b/src/ps5/notify.c
new file mode 100644
index 0000000..4e5b23c
--- /dev/null
+++ b/src/ps5/notify.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 2024 John Törnblom
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING. If not, see
+. */
+
+#include
+#include
+#include
+
+
+typedef struct notify_request {
+ char useless1[45];
+ char message[3075];
+} notify_request_t;
+
+
+int sceKernelSendNotificationRequest(int, notify_request_t*, size_t, int);
+
+
+void
+notify(const char *fmt, ...) {
+ notify_request_t req;
+ va_list args;
+
+ bzero(&req, sizeof req);
+ va_start(args, fmt);
+ vsnprintf(req.message, sizeof req.message, fmt, args);
+ va_end(args);
+
+ sceKernelSendNotificationRequest(0, &req, sizeof req, 0);
+}
diff --git a/src/ps5/notify.h b/src/ps5/notify.h
new file mode 100644
index 0000000..5e21bb3
--- /dev/null
+++ b/src/ps5/notify.h
@@ -0,0 +1,20 @@
+/* Copyright (C) 2024 John Törnblom
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING. If not, see
+. */
+
+#pragma once
+
+
+void notify(const char *fmt, ...);
diff --git a/src/ps5/sys.c b/src/ps5/sys.c
index ea74f33..a3cff32 100644
--- a/src/ps5/sys.c
+++ b/src/ps5/sys.c
@@ -14,6 +14,11 @@ You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, see
. */
+#include
+#include
+#include
+#include
+
#include
#include
#include
@@ -29,6 +34,7 @@ along with this program; see the file COPYING. If not, see
#include "elfldr.h"
#include "hbldr.h"
+#include "notify.h"
#include "pt.h"
#include "sys.h"
#include "websrv.h"
@@ -308,6 +314,48 @@ sys_launch_title(const char* title_id, const char* args) {
}
+/**
+ * Serve FTP on a given port.
+ **/
+static int
+ps5_display_server(uint16_t port){
+ struct ifaddrs *ifaddr;
+ char ip[INET_ADDRSTRLEN];
+
+ if(getifaddrs(&ifaddr) == -1) {
+ return -1;
+ }
+
+ // Enumerate all AF_INET IPs
+ for(struct ifaddrs *ifa=ifaddr; ifa!=NULL; ifa=ifa->ifa_next) {
+ if(ifa->ifa_addr == NULL) {
+ continue;
+ }
+
+ if(ifa->ifa_addr->sa_family != AF_INET) {
+ continue;
+ }
+
+ // skip localhost
+ if(!strncmp("lo", ifa->ifa_name, 2)) {
+ continue;
+ }
+
+ struct sockaddr_in *in = (struct sockaddr_in*)ifa->ifa_addr;
+ inet_ntop(AF_INET, &(in->sin_addr), ip, sizeof(ip));
+
+ // skip interfaces without an ip
+ if(!strncmp("0.", ip, 2)) {
+ continue;
+ }
+
+ notify("Serving HTTP on %s:%d (%s)\n", ip, port, ifa->ifa_name);
+ }
+ return 0;
+}
+
+
+
__attribute__((constructor)) static void
ps5_init(void) {
pid_t pid;
@@ -329,6 +377,8 @@ ps5_init(void) {
}
kernel_set_ucred_authid(-1, 0x4801000000000013L);
+
+ ps5_display_server(8080);
}