Implement corrections

This commit is contained in:
Oreo639 2019-05-03 15:42:20 -07:00
parent 35921f83f9
commit 6f92bdb7b9
3 changed files with 19 additions and 21 deletions

View File

@ -1983,7 +1983,7 @@ ENABLE_PREPROCESSING = YES
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
MACRO_EXPANSION = YES MACRO_EXPANSION = NO
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
# the macro expansion is limited to the macros specified with the PREDEFINED and # the macro expansion is limited to the macros specified with the PREDEFINED and
@ -1991,7 +1991,7 @@ MACRO_EXPANSION = YES
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
EXPAND_ONLY_PREDEF = YES EXPAND_ONLY_PREDEF = NO
# If the SEARCH_INCLUDES tag is set to YES, the include files in the # If the SEARCH_INCLUDES tag is set to YES, the include files in the
# INCLUDE_PATH will be searched if a #include is found. # INCLUDE_PATH will be searched if a #include is found.
@ -2023,7 +2023,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator. # recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = PACKED PREDEFINED =
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The # tag can be used to specify a list of macro names that should be expanded. The

View File

@ -153,7 +153,10 @@ void miiSelectorBlacklistUserMii(MiiSelectorConf *conf, u32 index);
* If there is no mii with that index, the the cursor will start at the Mii * If there is no mii with that index, the the cursor will start at the Mii
* with the index 0 (the personal Mii). * with the index 0 (the personal Mii).
*/ */
void miiSelectorSetInitalIndex(MiiSelectorConf *conf, u32 index); static inline void miiSelectorSetInitialIndex(MiiSelectorConf *conf, u32 index)
{
conf->initial_index = index;
}
/** /**
* @brief Get Mii name * @brief Get Mii name

View File

@ -76,17 +76,16 @@ void miiSelectorSetTitle(MiiSelectorConf *conf, const char* text)
miiSelectorConvertToUTF16(conf->title, text, MIISELECTOR_TITLE_LEN); miiSelectorConvertToUTF16(conf->title, text, MIISELECTOR_TITLE_LEN);
} }
static const u8 miiSelectorOptions[] = void miiSelectorSetOptions(MiiSelectorConf *conf, u32 options)
{ {
static const u8 miiSelectorOptions[] =
{
offsetof(MiiSelectorConf, enable_cancel_button), offsetof(MiiSelectorConf, enable_cancel_button),
offsetof(MiiSelectorConf, enable_selecting_guests), offsetof(MiiSelectorConf, enable_selecting_guests),
offsetof(MiiSelectorConf, show_on_top_screen), offsetof(MiiSelectorConf, show_on_top_screen),
offsetof(MiiSelectorConf, show_guest_page), offsetof(MiiSelectorConf, show_guest_page),
}; };
for (int i = 0; i < sizeof(miiSelectorOptions); i ++)
void miiSelectorSetOptions(MiiSelectorConf *conf, u32 options)
{
for (int i = 0; i < (sizeof(miiSelectorOptions)/sizeof(char)); i ++)
*((u8*)conf + miiSelectorOptions[i]) = (options & BIT(i)) ? 1 : 0; *((u8*)conf + miiSelectorOptions[i]) = (options & BIT(i)) ? 1 : 0;
} }
@ -126,10 +125,6 @@ void miiSelectorBlacklistUserMii(MiiSelectorConf *conf, u32 index)
conf->mii_whitelist[i] = 0; conf->mii_whitelist[i] = 0;
} }
void miiSelectorSetInitalIndex(MiiSelectorConf *conf, u32 index) {
conf->initial_index = index;
}
void miiSelectorReturnGetName(const MiiSelectorReturn *returnbuf, char* out, size_t max_size) void miiSelectorReturnGetName(const MiiSelectorReturn *returnbuf, char* out, size_t max_size)
{ {
if (!out) if (!out)
@ -151,7 +146,7 @@ void miiSelectorReturnGetAuthor(const MiiSelectorReturn *returnbuf, char* out, s
static u16 crc16_ccitt(void const *buf, size_t len, uint32_t starting_val) static u16 crc16_ccitt(void const *buf, size_t len, uint32_t starting_val)
{ {
if(buf == NULL) if (!buf)
return -1; return -1;
u8 const *cbuf = buf; u8 const *cbuf = buf;
@ -159,13 +154,13 @@ static u16 crc16_ccitt(void const *buf, size_t len, uint32_t starting_val)
static const u16 POLY = 0x1021; static const u16 POLY = 0x1021;
for(size_t i = 0; i < len; i++) for (size_t i = 0; i < len; i++)
{ {
for(int bit = 7; bit >= 0; bit--) for (int bit = 7; bit >= 0; bit--)
crc = ((crc << 1) | ((cbuf[i] >> bit) & 0x1)) ^ (crc & 0x8000 ? POLY : 0); crc = ((crc << 1) | ((cbuf[i] >> bit) & 0x1)) ^ (crc & 0x8000 ? POLY : 0);
} }
for(int _ = 0; _ < 16; _++) for (int _ = 0; _ < 16; _++)
crc = (crc << 1) ^ (crc & 0x8000 ? POLY : 0); crc = (crc << 1) ^ (crc & 0x8000 ? POLY : 0);
return (u16)(crc & 0xffff); return (u16)(crc & 0xffff);