Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/notify/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ endif

ELF := notify.elf

CFLAGS := -Wall -Werror -g
CFLAGS := -Wall -Werror -g -lSceNotification

all: $(ELF)

Expand Down
72 changes: 56 additions & 16 deletions samples/notify/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,68 @@ along with this program; see the file COPYING. If not, see

#include <stdio.h>
#include <string.h>
#include <stdbool.h>

#define SCE_NOTIFICATION_LOCAL_USER_ID_SYSTEM 0xFE
int sceNotificationSend(int userId, bool isLogged, const char* payload);

typedef struct notify_request {
char useless1[45];
char message[3075];
} notify_request_t;


int sceKernelSendNotificationRequest(int, notify_request_t*, size_t, int);
static const char json_payload[] =
"{\n"
" \"rawData\": {\n"
" \"viewTemplateType\": \"InteractiveToastTemplateB\",\n"
" \"channelType\": \"Downloads\",\n"
" \"useCaseId\": \"IDC\",\n"
" \"toastOverwriteType\": \"No\",\n"
" \"isImmediate\": true,\n"
" \"priority\": 100,\n"
" \"viewData\": {\n"
" \"icon\": {\n"
" \"type\": \"Url\",\n"
" \"parameters\": {\n"
" \"url\": \"/path/to/icon.png\"\n"
" }\n"
" },\n"
" \"message\": {\n"
" \"body\": \"Hello World!\"\n"
" },\n"
" \"subMessage\": {\n"
" \"body\": \"notify sample\"\n"
" },\n"
" \"actions\": [\n"
" {\n"
" \"actionName\": \"Go to debug settings\",\n"
" \"actionType\": \"DeepLink\",\n"
" \"defaultFocus\": true,\n"
" \"parameters\": {\n"
" \"actionUrl\": \"pssettings:play?function=debug_settings\"\n"
" }\n"
" }\n"
" ]\n"
" },\n"
" \"platformViews\": {\n"
" \"previewDisabled\": {\n"
" \"viewData\": {\n"
" \"icon\": {\n"
" \"type\": \"Predefined\",\n"
" \"parameters\": {\n"
" \"icon\": \"download\"\n"
" }\n"
" },\n"
" \"message\": {\n"
" \"body\": \"notify sample is running\"\n"
" }\n"
" }\n"
" }\n"
" }\n"
" },\n"
" \"createdDateTime\": \"2025-12-14T03:14:51.473Z\",\n"
" \"localNotificationId\": \"588193127\"\n"
"}";


int
main(int argc, char *argv[]) {
notify_request_t req;

bzero(&req, sizeof req);
if(argc == 1) {
snprintf(req.message, sizeof req.message, "%s", argv[0]);
} else if(argc >= 2) {
snprintf(req.message, sizeof req.message, "%s: %s", argv[0], argv[1]);
}
return sceNotificationSend(SCE_NOTIFICATION_LOCAL_USER_ID_SYSTEM, true, json_payload);

return sceKernelSendNotificationRequest(0, &req, sizeof req, 0);
}

7 changes: 7 additions & 0 deletions sce_stubs/libSceNotification.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
asm(".global sceNotificationSend\n"
".type sceNotificationSend @function\n"
"sceNotificationSend:\n");

asm(".global sceNotificationSendById\n"
".type sceNotificationSendById @function\n"
"sceNotificationSendById:\n");
Loading