From 0139890679f026e81d2d0f0a4c1cfd2052d1529c Mon Sep 17 00:00:00 2001 From: Oreo639 Date: Sun, 14 Apr 2019 16:57:17 -0700 Subject: [PATCH] Add miiSelectorInit --- libctru/include/3ds/applets/miiselector.h | 17 ++++++++++++----- libctru/source/applets/miiselector.c | 11 +++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/libctru/include/3ds/applets/miiselector.h b/libctru/include/3ds/applets/miiselector.h index c4bb10e..8d03603 100644 --- a/libctru/include/3ds/applets/miiselector.h +++ b/libctru/include/3ds/applets/miiselector.h @@ -79,6 +79,12 @@ enum MIISELECTOR_GUESTSTART = BIT(3), ///< Start on guest page }; +/** + * @brief Initialize Mii selector config + * @param conf Pointer to Miiselector config. + */ +void miiSelectorInit(MiiSelectorConf *conf); + /** * @brief Launch the Mii selector library applet * @@ -107,7 +113,7 @@ void miiSelectorSetOptions(MiiSelectorConf *conf, u32 options); * @brief Specifies which guest Miis will be selectable * * @param conf Pointer to miiSelector configuration - * @param index Index of the guest Mii that will be whitelisted. + * @param index Index of the guest Miis that will be whitelisted. * @ref MIISELECTOR_GUESTMII_SLOTS can be used to whitelist all the guest Miis. */ void miiSelectorWhitelistGuestMii(MiiSelectorConf *conf, u32 index); @@ -116,7 +122,7 @@ void miiSelectorWhitelistGuestMii(MiiSelectorConf *conf, u32 index); * @brief Specifies which guest Miis will be unselectable * * @param conf Pointer to miiSelector configuration - * @param index Index of the guest Mii that will be blacklisted. + * @param index Index of the guest Miis that will be blacklisted. * @ref MIISELECTOR_GUESTMII_SLOTS can be used to blacklist all the guest Miis. */ void miiSelectorBlacklistGuestMii(MiiSelectorConf *conf, u32 index); @@ -125,7 +131,7 @@ void miiSelectorBlacklistGuestMii(MiiSelectorConf *conf, u32 index); * @brief Specifies which user Miis will be selectable * * @param conf Pointer to miiSelector configuration - * @param index Index of the user Mii that will be whitelisted. + * @param index Index of the user Miis that will be whitelisted. * @ref MIISELECTOR_USERMII_SLOTS can be used to whitlist all the user Miis */ void miiSelectorWhitelistUserMii(MiiSelectorConf *conf, u32 index); @@ -134,7 +140,7 @@ void miiSelectorWhitelistUserMii(MiiSelectorConf *conf, u32 index); * @brief Specifies which user Miis will be selectable * * @param conf Pointer to miiSelector configuration - * @param index Index of the user Mii that will be blacklisted. + * @param index Index of the user Miis that will be blacklisted. * @ref MIISELECTOR_USERMII_SLOTS can be used to blacklist all the user Miis */ void miiSelectorBlacklistUserMii(MiiSelectorConf *conf, u32 index); @@ -144,7 +150,8 @@ void miiSelectorBlacklistUserMii(MiiSelectorConf *conf, u32 index); * * @param conf Pointer to miiSelector configuration * @param index Indexed number of the Mii that the cursor will start on. - * If there is no mii with that index, the the cursor will start at index 0. + * If there is no mii with that index, the the cursor will start at the Mii + * with the index 0 (the personal Mii). */ void miiSelectorSetInitalIndex(MiiSelectorConf *conf, u32 index); diff --git a/libctru/source/applets/miiselector.c b/libctru/source/applets/miiselector.c index 9a50c94..a00c98e 100644 --- a/libctru/source/applets/miiselector.c +++ b/libctru/source/applets/miiselector.c @@ -7,6 +7,17 @@ #include // for memcpy +void miiSelectorInit(MiiSelectorConf *conf) +{ + memset(conf, 0, sizeof(*conf)); + + for (int i = 0; i < MIISELECTOR_GUESTMII_SLOTS; i ++) + conf->mii_guest_whitelist[i] = 1; + + for (int i = 0; i < MIISELECTOR_USERMII_SLOTS; i ++) + conf->mii_whitelist[i] = 1; +} + Result miiSelectorLaunch(const MiiSelectorConf *conf, MiiSelectorReturn *returnbuf) { union {