Homebrew NEWS_AddNotification crashes

  • Thread starter Thread starter Woni
  • Start date Start date
  • Views Views 1,484
  • Replies Replies 8

Woni

Active Member
Newcomer
Joined
Jan 2, 2016
Messages
30
Reaction score
11
Trophies
0
Age
106
XP
109
Country
France
Result res = NEWS_AddNotification(u"title",5,u"message",7,NULL,0,false);

It crashes, please help.

EDIT: ctrulib code is broken atm with news:s
 
Last edited by Woni,
You shall declare an u16 string as:
Code:
const u16 title[] = { 0x0074, 0x0065, 0x0073, 0x0074, 0x0000 };
const u16 message[] = { 0x006D, 0x0065, 0x0073, 0x0073, 0x0061, 0x0067, 0x0065, 0x0000 };

And use it as:
Code:
newsInit();

// ...

res = NEWS_AddNotification(title, titleLength /* 4 */, message, messageLength /* 7 */, NULL, 0, false);

// ...

newsExit();
 
It doesn't work
Code:
const u16 title[] = { 0x0074, 0x0065, 0x0073, 0x0074};
    const u16 message[] = { 0x006D, 0x0065, 0x0073, 0x0073, 0x0061, 0x0067, 0x0065};
    u16* dataTitle = title;
    u16* dataMessage = message;
    u32 titleLength = 4;
    u32 messageLength = 7;
    u32 imageSize = 0;
    res = NEWS_AddNotification(dataTitle,titleLength,dataMessage,messageLength,NULL,imageSize,false);
 
Last edited by Woni,
It doesn't work
Code:
const u16 title[] = { 0x0074, 0x0065, 0x0073, 0x0074};
    const u16 message[] = { 0x006D, 0x0065, 0x0073, 0x0073, 0x0061, 0x0067, 0x0065};
    u16* dataTitle = title;
    u16* dataMessage = message;
    u32 titleLength = 4;
    u32 messageLength;
    u32 imageSize = 0;
    res = NEWS_AddNotification(dataTitle,titleLength,dataMessage,messageLength,NULL,imageSize,false);

You seem a little confused on what a pointer is, an array is and how to use them properly. I suggest you to read some more about the topic before proceding.
 
This doesn't work
Code:
const u16 title[] = { 0x0074, 0x0065, 0x0073, 0x0074,0x0000};
const u16 message[] = { 0x006D, 0x0065, 0x0073, 0x0073, 0x0061, 0x0067, 0x0065,0x0000};   
u32 titleLength = 4;
u32 messageLength = 7;
u32 imageSize = 0;
res = NEWS_AddNotification(title,titleLength,message,messageLength,NULL,imageSize,false);
 
This doesn't work
Code:
const u16 title[] = { 0x0074, 0x0065, 0x0073, 0x0074,0x0000};
const u16 message[] = { 0x006D, 0x0065, 0x0073, 0x0073, 0x0061, 0x0067, 0x0065,0x0000};  
u32 titleLength = 4;
u32 messageLength = 7;
u32 imageSize = 0;
res = NEWS_AddNotification(title,titleLength,message,messageLength,NULL,imageSize,false);
Did you PROPERLY initialize the mews module using newsInit(); ?
 
Code:
Result res = newsInit();
if(R_FAILED(res))
    printf("news service failed init\n");
else
    printf("news service init successful\n");
Yes
 
Code:
#include <3ds.h>

int main(int argc, char **argv)
{
    newsInit();
    
    const u16 title[] = { 0x0074, 0x0065, 0x0073, 0x0074, 0x0000 };
    const u16 message[] = { 0x006D, 0x0065, 0x0073, 0x0073, 0x0061, 0x0067, 0x0065, 0x0000 };
    
    Result res = NEWS_AddNotification(title, 4, message, 7, NULL, 0, false);
    
    while ( aptMainLoop() )
    {
        hidScanInput();
        if (res)
            break;
        if (hidKeysDown() & KEY_START)
            break;
    }
   
    newsExit();
   
    return 0;
}

This works for me when I run as cia.
 
Code:
#include <3ds.h>

int main(int argc, char **argv)
{
    newsInit();
   
    const u16 title[] = { 0x0074, 0x0065, 0x0073, 0x0074, 0x0000 };
    const u16 message[] = { 0x006D, 0x0065, 0x0073, 0x0073, 0x0061, 0x0067, 0x0065, 0x0000 };
   
    Result res = NEWS_AddNotification(title, 4, message, 7, NULL, 0, false);
   
    while ( aptMainLoop() )
    {
        hidScanInput();
        if (res)
            break;
        if (hidKeysDown() & KEY_START)
            break;
    }
  
    newsExit();
  
    return 0;
}

This works for me when I run as cia.
You have CFW so you can use news:u, it doesn't work when using news:s, it's a ctrulib issue
 

Site & Scene News

Popular threads in this forum