From 4512de73da4e9040acdb4775ffaaad5d7a30ffcb Mon Sep 17 00:00:00 2001 From: Maschell Date: Thu, 3 Feb 2022 13:03:38 +0100 Subject: [PATCH] Update .clang-format to change comment and macro formatting --- .clang-format | 3 ++- source/BootUtils.cpp | 10 +++++----- source/DrawUtils.cpp | 2 +- source/DrawUtils.h | 2 +- source/MenuUtils.cpp | 6 +++--- source/QuickStartUtils.cpp | 6 +++--- source/StorageUtils.cpp | 2 +- source/logger.cpp | 4 ++-- source/logger.h | 4 ++-- 9 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.clang-format b/.clang-format index 92399ef..533ffee 100644 --- a/.clang-format +++ b/.clang-format @@ -3,6 +3,7 @@ BasedOnStyle: LLVM AccessModifierOffset: -4 AlignAfterOpenBracket: Align AlignConsecutiveAssignments: None +AlignConsecutiveMacros: AcrossEmptyLinesAndComments AlignOperands: Align AllowAllArgumentsOnNextLine: false AllowAllConstructorInitializersOnNextLine: false @@ -56,7 +57,7 @@ SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements SpaceBeforeRangeBasedForLoopColon: true SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 0 +SpacesBeforeTrailingComments: 1 SpacesInAngles: false SpacesInCStyleCastParentheses: false SpacesInContainerLiterals: false diff --git a/source/BootUtils.cpp b/source/BootUtils.cpp index 386b57a..f0d81f1 100644 --- a/source/BootUtils.cpp +++ b/source/BootUtils.cpp @@ -32,9 +32,9 @@ void bootWiiUMenu() { nn::act::SlotNo defaultSlot = nn::act::GetDefaultAccount(); nn::act::Finalize(); - if (defaultSlot) {//normal menu boot + if (defaultSlot) { //normal menu boot SYSLaunchMenu(); - } else {//show mii select + } else { //show mii select _SYSLaunchMenuWithCheckingAccount(slot); } } @@ -50,7 +50,7 @@ void handleAccountSelection() { nn::act::Initialize(); nn::act::SlotNo defaultSlot = nn::act::GetDefaultAccount(); - if (!defaultSlot) {// No default account is set. + if (!defaultSlot) { // No default account is set. std::vector> accountInfoList; for (int32_t i = 0; i < 13; i++) { if (!nn::act::IsSlotOccupied(i)) { @@ -134,9 +134,9 @@ void bootHomebrewChannel() { // test if the OHBC or HBC is installed if (IOSUHAX_FSA_GetStat(fsaFd, "/vol/storage_slccmpt01/title/00010001/4f484243/content/00000000.app", &stat) >= 0) { - titleId = 0x000100014F484243L;// 'OHBC' + titleId = 0x000100014F484243L; // 'OHBC' } else if (IOSUHAX_FSA_GetStat(fsaFd, "/vol/storage_slccmpt01/title/00010001/4c554c5a/content/00000000.app", &stat) >= 0) { - titleId = 0x000100014C554C5AL;// 'LULZ' + titleId = 0x000100014C554C5AL; // 'LULZ' } else { DEBUG_FUNCTION_LINE("Cannot find HBC, booting vWii System Menu"); } diff --git a/source/DrawUtils.cpp b/source/DrawUtils.cpp index 0aad4de..6c49b8c 100644 --- a/source/DrawUtils.cpp +++ b/source/DrawUtils.cpp @@ -11,7 +11,7 @@ #include "MenuUtils.h" // buffer width -#define TV_WIDTH 0x500 +#define TV_WIDTH 0x500 #define DRC_WIDTH 0x380 bool DrawUtils::isBackBuffer; diff --git a/source/DrawUtils.h b/source/DrawUtils.h index 3cf8cc8..526fe2a 100644 --- a/source/DrawUtils.h +++ b/source/DrawUtils.h @@ -3,7 +3,7 @@ #include // visible screen sizes -#define SCREEN_WIDTH 854 +#define SCREEN_WIDTH 854 #define SCREEN_HEIGHT 480 union Color { diff --git a/source/MenuUtils.cpp b/source/MenuUtils.cpp index 5066b30..f047c5f 100644 --- a/source/MenuUtils.cpp +++ b/source/MenuUtils.cpp @@ -33,11 +33,11 @@ const char *autoboot_config_strings[] = { template std::string string_format(const std::string &format, Args... args) { - int size_s = std::snprintf(nullptr, 0, format.c_str(), args...) + 1;// Extra space for '\0' + int size_s = std::snprintf(nullptr, 0, format.c_str(), args...) + 1; // Extra space for '\0' auto size = static_cast(size_s); auto buf = std::make_unique(size); std::snprintf(buf.get(), size, format.c_str(), args...); - return std::string(buf.get(), buf.get() + size - 1);// We don't want the '\0' inside + return std::string(buf.get(), buf.get() + size - 1); // We don't want the '\0' inside } int32_t readAutobootOption(std::string &configPath) { @@ -222,7 +222,7 @@ nn::act::SlotNo handleAccountSelectScreen(const std::vectormiiImageBuffer[col + 1])[0]; - if (colVal == 0x00808080) {// Remove the green background. + if (colVal == 0x00808080) { // Remove the green background. DrawUtils::drawPixel(x + xOffset, y + yOffset, COLOR_BACKGROUND.r, COLOR_BACKGROUND.g, COLOR_BACKGROUND.b, COLOR_BACKGROUND.a); } else { DrawUtils::drawPixel(x + xOffset, y + yOffset, val->miiImageBuffer[col + 1], val->miiImageBuffer[col + 2], val->miiImageBuffer[col + 3], val->miiImageBuffer[col]); diff --git a/source/QuickStartUtils.cpp b/source/QuickStartUtils.cpp index 7eefae7..10b9872 100644 --- a/source/QuickStartUtils.cpp +++ b/source/QuickStartUtils.cpp @@ -87,7 +87,7 @@ bool getQuickBoot() { if (bootCheck == 0) { nn::sl::Initialize(MEMAllocFromDefaultHeapEx, MEMFreeToDefaultHeap); char path[0x80]; - nn::sl::GetDefaultDatabasePath(path, 0x80, 0x0005001010066000);// ECO process + nn::sl::GetDefaultDatabasePath(path, 0x80, 0x0005001010066000); // ECO process FSCmdBlock cmdBlock; FSInitCmdBlock(&cmdBlock); @@ -101,7 +101,7 @@ bool getQuickBoot() { auto database = new nn::sl::LaunchInfoDatabase; database->Load(fileStream, nn::sl::REGION_EUR); - CCRAppLaunchParam data;// load sys caffeine data + CCRAppLaunchParam data; // load sys caffeine data // load app launch param CCRSysCaffeineGetAppLaunchParam(&data); @@ -197,7 +197,7 @@ bool getQuickBoot() { return true; } - if (info.titleId == 0x0005001010004000L) {// OSv0 + if (info.titleId == 0x0005001010004000L) { // OSv0 DEBUG_FUNCTION_LINE("Launching vWii System Menu"); bootvWiiMenu(); diff --git a/source/StorageUtils.cpp b/source/StorageUtils.cpp index 38e69af..e215cef 100644 --- a/source/StorageUtils.cpp +++ b/source/StorageUtils.cpp @@ -105,7 +105,7 @@ void initExternalStorage() { int tries = 0; bool found = false; - while (tries < 1200) {// Wait up to 20 seconds, like the Wii U Menu + while (tries < 1200) { // Wait up to 20 seconds, like the Wii U Menu int32_t numItems = nn::spm::GetStorageList(items, 0x20); DEBUG_FUNCTION_LINE("Number of items: %d", numItems); diff --git a/source/logger.cpp b/source/logger.cpp index 05d2661..c954129 100644 --- a/source/logger.cpp +++ b/source/logger.cpp @@ -17,7 +17,7 @@ void initLogging() { cafeLogInit = WHBLogCafeInit(); udpLogInit = WHBLogUdpInit(); } -#endif// DEBUG +#endif // DEBUG } void deinitLogging() { @@ -34,5 +34,5 @@ void deinitLogging() { WHBLogUdpDeinit(); udpLogInit = false; } -#endif// DEBUG +#endif // DEBUG } \ No newline at end of file diff --git a/source/logger.h b/source/logger.h index c6b5e29..2d0ca67 100644 --- a/source/logger.h +++ b/source/logger.h @@ -10,7 +10,7 @@ extern "C" { #ifdef DEBUG #define __FILENAME_X__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__) -#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILENAME_X__) +#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILENAME_X__) #define DEBUG_FUNCTION_LINE(FMT, ARGS...) \ do { \ @@ -24,7 +24,7 @@ extern "C" { #else -#define DEBUG_FUNCTION_LINE(FMT, ARGS...) while (0) +#define DEBUG_FUNCTION_LINE(FMT, ARGS...) while (0) #define DEBUG_FUNCTION_LINE_WRITE(FMT, ARGS...) while (0)