Fix network watchdog logic, add icon install notification

This commit is contained in:
KarnerF committed 2026-08-15 09:55:39 +02:00
1 parent 241a30796d
commit 3111bb7df1
2 files changed
+11 -6

No files matched your search

+7 -1
View File
@@ -7,6 +7,8 @@
#include "app_installer.h"
extern int sceNotificationSend(int uid, int logged, const char *payload);
/* Assets einbetten - exakt wie Payload Manager und Game Compressor */
#define INCASSET(name, file) \
__asm__(".section .rodata\n" \
@@ -73,9 +75,13 @@ void smplus_install_if_needed(int icon_always_front) {
if (write_file(ico, sm_icon0_png, sm_icon0_png_size) != 0) goto done;
install_title_dir(TITLE_ID, APP_ROOT "/");
/* write marker so once-only mode knows it was installed */
mkdir("/data/SMPlusGui", 0755);
write_file(MARKER, (const uint8_t *)"ok\n", 3);
sceNotificationSend(0xFE,1,"{\"rawData\":{\"viewTemplateType\":\"InteractiveToastTemplateB\","
"\"channelType\":\"Downloads\",\"useCaseId\":\"IDC\",\"toastOverwriteType\":\"No\","
"\"isImmediate\":true,\"priority\":100,\"viewData\":{\"icon\":{\"type\":\"Predefined\","
"\"parameters\":{\"icon\":\"download\"}},\"message\":{\"body\":\"SMPlusGui: Icon installiert\"}},"
"\"createdDateTime\":\"2025-01-01T00:00:00.000Z\",\"localNotificationId\":\"ico1\"}}");
done:
sceAppInstUtilTerminate();
+4 -5
View File
@@ -2693,19 +2693,18 @@ int payload_main(void) {
if(++net_timer>=10){
net_timer=0;
char new_ip[48]={0}; get_local_ip(new_ip,sizeof(new_ip));
/* trigger restart if: IP changed, IP returned after being empty, or SIGCONT received */
int ip_changed = (new_ip[0] && strcmp(new_ip,cur_ip)!=0);
int ip_restored = (!cur_ip[0] && new_ip[0]); /* was lost, now back */
int ip_restored = (!cur_ip[0] && new_ip[0]);
if(ip_changed||ip_restored||smg_resume){
smg_resume=0;
strncpy(cur_ip,new_ip[0]?new_ip:cur_ip,47);
} else if(!new_ip[0]&&cur_ip[0]) {
cur_ip[0]=0; /* mark IP as lost so restore is detected */
if(new_ip[0]) strncpy(cur_ip,new_ip,47);
mg_mgr_free(&mgr); usleep(500000); mg_mgr_init(&mgr);
mg_http_listen(&mgr,"http://0.0.0.0:" HTTP_PORT,fn,NULL);
smg_mgr=&mgr;
char url[64]; snprintf(url,sizeof(url),"http://%s:" HTTP_PORT,cur_ip);
_notify_send("SMPlusGui v" SMPLUS_VERSION, url);
} else if(!new_ip[0]&&cur_ip[0]) {
cur_ip[0]=0; /* IP lost — next cycle with IP will trigger restore */
}
}
} }