Homebrew NEWS_AddNotification crashes

Woni

Active Member
OP
Newcomer
Joined
Jan 2, 2016
Messages
30
Trophies
0
Age
104
XP
89
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,

Gocario

GBAFail'd
Member
Joined
Sep 5, 2015
Messages
640
Trophies
0
Location
Bourg Palette
XP
804
Country
France
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();
 

Woni

Active Member
OP
Newcomer
Joined
Jan 2, 2016
Messages
30
Trophies
0
Age
104
XP
89
Country
France
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,

Slashcash

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
338
Trophies
0
XP
611
Country
Italy
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.
 

Woni

Active Member
OP
Newcomer
Joined
Jan 2, 2016
Messages
30
Trophies
0
Age
104
XP
89
Country
France
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);
 

UraKn0x

Official senpai
Member
Joined
Mar 20, 2014
Messages
370
Trophies
0
XP
735
Country
France
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(); ?
 

Woni

Active Member
OP
Newcomer
Joined
Jan 2, 2016
Messages
30
Trophies
0
Age
104
XP
89
Country
France
Code:
Result res = newsInit();
if(R_FAILED(res))
    printf("news service failed init\n");
else
    printf("news service init successful\n");
Yes
 

Ryuzaki_MrL

Green Thunder
Member
Joined
Jun 23, 2015
Messages
781
Trophies
0
Age
26
XP
2,040
Country
Brazil
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.
 

Woni

Active Member
OP
Newcomer
Joined
Jan 2, 2016
Messages
30
Trophies
0
Age
104
XP
89
Country
France
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

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: Nut on the hill