*/
Result NEWS_GetNotificationHeader(u32 news_id, NotificationHeader* header);
+/**
+ * @brief Sets a custom message for a specific notification.
+ * @param news_id Identification number of the notification.
+ * @param message Pointer to UTF-16 message to set.
+ * @param size Size of message to set.
+ */
+Result NEWS_SetNotificationMessage(u32 news_id, const u16* message, u32 size);
+
/**
* @brief Gets the message of a specific notification.
* @param news_id Identification number of the notification.
* @param message Pointer where UTF-16 message of the notification will be saved.
+ * @param size Pointer where size of the message data will be saved in bytes.
+ */
+Result NEWS_GetNotificationMessage(u32 news_id, u16* message, u32* size);
+
+/**
+ * @brief Sets a custom image for a specific notification.
+ * @param news_id Identification number of the notification.
+ * @param buffer Pointer to MPO image to set.
+ * @param size Size of the MPO image to set.
*/
-Result NEWS_GetNotificationMessage(u32 news_id, u16* message);
+Result NEWS_SetNotificationImage(u32 news_id, const void* buffer, u32 size);
/**
* @brief Gets the image of a specific notification.
cmdbuf[4] = (u32)header;
if(R_FAILED(ret = svcSendSyncRequest(newsHandle))) return ret;
- return (Result)cmdbuf[1];
+ return (Result)cmdbuf[1];
}
Result NEWS_GetNotificationHeader(u32 news_id, NotificationHeader* header)
return (Result)cmdbuf[1];
}
-Result NEWS_GetNotificationMessage(u32 news_id, u16* message)
+Result NEWS_SetNotificationMessage(u32 news_id, const u16* message, u32 size)
+{
+ Result ret = 0;
+ u32 *cmdbuf = getThreadCommandBuffer();
+
+ cmdbuf[0] = IPC_MakeHeader(0x8,2,2);
+ cmdbuf[1] = news_id;
+ cmdbuf[2] = size;
+ cmdbuf[3] = IPC_Desc_Buffer((size_t)0x1780,IPC_BUFFER_R);
+ cmdbuf[4] = (u32)message;
+
+ if(R_FAILED(ret = svcSendSyncRequest(newsHandle))) return ret;
+ return (Result)cmdbuf[1];
+}
+
+Result NEWS_GetNotificationMessage(u32 news_id, u16* message, u32* size)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[3] = IPC_Desc_Buffer((size_t)0x1780,IPC_BUFFER_W);
cmdbuf[4] = (u32)message;
+ if(R_FAILED(ret = svcSendSyncRequest(newsHandle))) return ret;
+ if(size) *size = cmdbuf[2];
+ return (Result)cmdbuf[1];
+}
+
+Result NEWS_SetNotificationImage(u32 news_id, const void* buffer, u32 size)
+{
+ Result ret = 0;
+ u32 *cmdbuf = getThreadCommandBuffer();
+
+ cmdbuf[0] = IPC_MakeHeader(0x9,2,2);
+ cmdbuf[1] = news_id;
+ cmdbuf[2] = size;
+ cmdbuf[3] = IPC_Desc_Buffer((size_t)0x10000,IPC_BUFFER_R);
+ cmdbuf[4] = (u32)buffer;
+
if(R_FAILED(ret = svcSendSyncRequest(newsHandle))) return ret;
return (Result)cmdbuf[1];
}
cmdbuf[4] = (u32)buffer;
if(R_FAILED(ret = svcSendSyncRequest(newsHandle))) return ret;
- *size = cmdbuf[2];
- return (Result)cmdbuf[1];
+ if(size) *size = cmdbuf[2];
+ return (Result)cmdbuf[1];
}
\ No newline at end of file