Add miiSelectorSetTitle
This commit is contained in:
parent
d0b6343342
commit
134e022568
@ -81,6 +81,14 @@ typedef struct
|
||||
*/
|
||||
Result miiSelectorLaunch(const MiiSelectorConf *conf, MiiSelectorReturn* returnbuf);
|
||||
|
||||
/**
|
||||
* @brief Sets title of the Mii selector library applet
|
||||
*
|
||||
* @param conf Pointer to the current Mii selector configuration
|
||||
* @param text Title text
|
||||
*/
|
||||
void miiSelectorSetTitle(MiiSelectorConf *conf, const char* text);
|
||||
|
||||
/**
|
||||
* @brief Verifies that the Mii data returned from the applet matches its
|
||||
* checksum
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <3ds/types.h>
|
||||
#include <3ds/result.h>
|
||||
#include <3ds/services/apt.h>
|
||||
#include <3ds/util/utf.h>
|
||||
|
||||
#include <3ds/applets/miiselector.h>
|
||||
|
||||
@ -24,6 +25,29 @@ Result miiSelectorLaunch(const MiiSelectorConf *conf, MiiSelectorReturn *returnb
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void miiSelectorConvertToUTF16(u16* out, const char* in, int max)
|
||||
{
|
||||
if (!in || !*in)
|
||||
{
|
||||
out[0] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
ssize_t units = utf8_to_utf16(out, (const uint8_t*)in, max);
|
||||
if (units < 0)
|
||||
{
|
||||
out[0] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
out[units] = 0;
|
||||
}
|
||||
|
||||
void miiSelectorSetTitle(MiiSelectorConf *conf, const char* text)
|
||||
{
|
||||
miiSelectorConvertToUTF16(conf->title, text, MIISELECTOR_TITLE_LEN);
|
||||
}
|
||||
|
||||
static u16 crc16_ccitt(void const *buf, size_t len, uint32_t starting_val)
|
||||
{
|
||||
if(buf == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user