DS Firmware Settings

Post Reply
Derrik
Posts: 63
Joined: Wed Aug 14, 2013 8:28 pm

DS Firmware Settings

Post by Derrik » Wed Aug 14, 2013 8:31 pm

I haven't found a lot of data about using the PersonalData struct and have run into a lot of trouble, I am a noob it seems.

The nickname is stored as s16[10], why is this? Why not just char[10]? What's more, is that there is no space for a NULL truncator (\0).

I first attempted to typecast it:

printf("Casted: %s", (char[10])PersonalData->name);

With a resultant compile error, I switched to this approach:

char username[11];
memset(username, 0, 11);
int i = 0;
for(i = 0; i < PersonalData->nameLen; i++) username = PersonalData->name;
printf("Nickname: %s", username);

Which works, but it just seems... Dumb. Is there a better way which I am missing?

Another problem I have is that attempting to write to this struct is only temporary, and my changes are reverted next time I turn on the DS:

PersonalData->name[0] = (s16)'k';

for(i = 0; i < PersonalData->nameLen; i++) username = PersonalData->name;
printf("Nickname: %s\n", username);

Is there a way to modify the actual settings in the DS firmware?

Thanks.

HarukaKaminari
Posts: 4
Joined: Tue Mar 06, 2012 1:00 pm

Re: DS Firmware Settings

Post by HarukaKaminari » Sat Sep 21, 2013 1:26 pm

Derrik wrote:The nickname is stored as s16[10], why is this? Why not just char[10]? What's more, is that there is no space for a NULL truncator (\0).
The nickname string is in UTF-16 format. So it must be stored as s16[]. Since there is a variable in PersonalData indicating the length of the nickname, terminator is not necessary. http://nocash.emubase.de/gbatek.htm#dsf ... ersettings
Derrik wrote: char username[11];
memset(username, 0, 11);
int i = 0;
for(i = 0; i < PersonalData->nameLen; i++) username = PersonalData->name;
printf("Nickname: %s", username);

It indeed works, and this is not a dumb method. However the string is in UTF-16 format, so this solution only works good when the nickname contains only ASCII characters. If the nickname contains Japanese Hiragana/Katakana or symbols that can not be coded in single-byte, it will output garbage.
A better solution is to introduce a codepage and a font that support UTF-16 characters.

Derrik wrote: Another problem I have is that attempting to write to this struct is only temporary, and my changes are reverted next time I turn on the DS:

PersonalData->name[0] = (s16)'k';

for(i = 0; i < PersonalData->nameLen; i++) username = PersonalData->name;
printf("Nickname: %s\n", username);

Is there a way to modify the actual settings in the DS firmware?

Modifying the userdata in the firmware is a little difficult.
You have to access the firmware Flash directly via the SPI. You have to know how to write commands (instructions) to SPI. Here is the instructions that may be useful. http://nocash.emubase.de/gbatek.htm#dsf ... lashmemory.
Editing the nickname only is completely useless, which will give you a failure screen if you do this. The userdata in the firmware is CRCed so that any modification in the firmware will be considered as data corruption. You must recalculate the CRC after editing the nickname, and write the new CRC value back to userdata to prevent corruption.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 11 guests