From fe894820a2c8ed60846a1ce290e4c71907c1472b Mon Sep 17 00:00:00 2001 From: Firew0lf Date: Thu, 24 Dec 2015 23:58:16 +0100 Subject: [PATCH] The ctr.news library should now be bug-free ! Untested, but checked 3 times with citra, and everything matches the doc. Warning: there is no check of any kind, so don't put weird stuff as arguments. --- source/news.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/news.c b/source/news.c index 200e33c..f97e6d9 100644 --- a/source/news.c +++ b/source/news.c @@ -10,6 +10,7 @@ The `news` module. #include #include +#include #include /*** @@ -23,7 +24,7 @@ static int news_init(lua_State *L) { } /*** -Send a notification to the user. WIP, do not use !!! +Send a notification to the user. Should work now. @function notification @tparam string title title of the notification @tparam[opt=nil] string message message of the notification, or nil for no message @@ -40,8 +41,8 @@ static int news_notification(lua_State *L) { if (lua_isboolean(L, 4)) jpeg = lua_toboolean(L, 4); - const u16* cTitle = 0; - const u16* cMessage = 0; + const u16* cTitle = malloc(strlen(title)*sizeof(u16)); + const u16* cMessage = malloc(strlen(message)*sizeof(u16)); u32 titleLength, messageLength; titleLength = (u32) utf8_to_utf16((uint16_t*)cTitle, (uint8_t*)title, strlen(title));