Format the code via clang-format (#3)

This commit is contained in:
Maschell 2022-02-02 19:57:14 +01:00 committed by GitHub
parent ad693c94ff
commit beedc7513c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 168 additions and 90 deletions

66
.clang-format Normal file
View File

@ -0,0 +1,66 @@
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: None
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: false
ContinuationIndentWidth: 8
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Right
ReflowComments: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 0
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Never

View File

@ -6,18 +6,18 @@ on:
- main - main
jobs: jobs:
clang-format:
build-binary:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Checkout submodules using a PAT - name: clang-format
run: | run: |
git config --file .gitmodules --get-regexp url | while read url; do docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source
git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/${{ secrets.CI_PAT }}:${{ secrets.CI_PAT }}@github.com\//") build-binary:
done runs-on: ubuntu-18.04
git submodule sync needs: clang-format
git submodule update --init --recursive steps:
- uses: actions/checkout@v2
- name: build binary - name: build binary
run: | run: |
docker build . -t builder docker build . -t builder

View File

@ -3,17 +3,18 @@ name: CI-PR
on: [pull_request] on: [pull_request]
jobs: jobs:
build-binary: clang-format:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Checkout submodules using a PAT - name: clang-format
run: | run: |
git config --file .gitmodules --get-regexp url | while read url; do docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source
git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/${{ secrets.CI_PAT }}:${{ secrets.CI_PAT }}@github.com\//") build-binary:
done runs-on: ubuntu-18.04
git submodule sync needs: clang-format
git submodule update --init --recursive steps:
- uses: actions/checkout@v2
- name: build binary - name: build binary
run: | run: |
docker build . -t builder docker build . -t builder

View File

@ -1,3 +1,4 @@
[![CI-Release](https://github.com/wiiu-env/AutobootModule/actions/workflows/ci.yml/badge.svg)](https://github.com/wiiu-env/AutobootModule/actions/workflows/ci.yml)
# AutobootModule # AutobootModule
This is a bootmenu targetted to be loaded with the [EnvironmentLoader](https://github.com/wiiu-env/EnvironmentLoader). It allows you to boot into the Wii U Menu, Homebrew Channel, vWii System Menu or vWii Homebrew Channel. This is a bootmenu targetted to be loaded with the [EnvironmentLoader](https://github.com/wiiu-env/EnvironmentLoader). It allows you to boot into the Wii U Menu, Homebrew Channel, vWii System Menu or vWii Homebrew Channel.
@ -33,6 +34,10 @@ docker run -it --rm -v ${PWD}:/project autobootmodule-builder make
docker run -it --rm -v ${PWD}:/project autobootmodule-builder make clean docker run -it --rm -v ${PWD}:/project autobootmodule-builder make clean
``` ```
## Format the code via docker
`docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source -i`
## Credits ## Credits
- GaryOderNichts - GaryOderNichts
- Maschell - Maschell

View File

@ -1,4 +1,7 @@
#pragma once #pragma once
#include <nn/act.h>
#include <stdint.h>
#include <string>
class AccountInfo { class AccountInfo {
public: public:

View File

@ -1,26 +1,26 @@
#include <malloc.h>
#include <string>
#include <map>
#include <locale>
#include <vector>
#include <codecvt> #include <codecvt>
#include <locale>
#include <malloc.h>
#include <map>
#include <memory> #include <memory>
#include <string>
#include <vector>
#include "ACTAccountInfo.h"
#include "BootUtils.h" #include "BootUtils.h"
#include "logger.h"
#include "DrawUtils.h" #include "DrawUtils.h"
#include "MenuUtils.h" #include "MenuUtils.h"
#include "ACTAccountInfo.h" #include "logger.h"
#include <coreinit/debug.h> #include <coreinit/debug.h>
#include <coreinit/screen.h> #include <coreinit/screen.h>
#include <nn/cmpt/cmpt.h> #include <gx2/state.h>
#include <nn/act.h> #include <nn/act.h>
#include <nn/cmpt/cmpt.h>
#include <padscore/kpad.h>
#include <sysapp/launch.h> #include <sysapp/launch.h>
#include <sysapp/title.h> #include <sysapp/title.h>
#include <padscore/kpad.h>
#include <vpad/input.h> #include <vpad/input.h>
#include <gx2/state.h>
#include <iosuhax.h> #include <iosuhax.h>

View File

@ -2,11 +2,11 @@
#include <malloc.h> #include <malloc.h>
#include <cmath> #include <cmath>
#include <coreinit/cache.h>
#include <coreinit/memory.h> #include <coreinit/memory.h>
#include <coreinit/screen.h> #include <coreinit/screen.h>
#include <coreinit/cache.h>
#include <png.h>
#include <ft2build.h> #include <ft2build.h>
#include <png.h>
#include FT_FREETYPE_H #include FT_FREETYPE_H
#include "MenuUtils.h" #include "MenuUtils.h"
@ -266,7 +266,8 @@ void DrawUtils::print(uint32_t x, uint32_t y, const char *string, bool alignRigh
buffer[num] = 0; buffer[num] = 0;
} else { } else {
wchar_t *tmp = buffer; wchar_t *tmp = buffer;
while ((*tmp++ = *string++)); while ((*tmp++ = *string++))
;
} }
print(x, y, buffer, alignRight); print(x, y, buffer, alignRight);
@ -306,7 +307,8 @@ uint32_t DrawUtils::getTextWidth(const char *string) {
buffer[num] = 0; buffer[num] = 0;
} else { } else {
wchar_t *tmp = buffer; wchar_t *tmp = buffer;
while ((*tmp++ = *string++)); while ((*tmp++ = *string++))
;
} }
uint32_t width = getTextWidth(buffer); uint32_t width = getTextWidth(buffer);

View File

@ -1,20 +1,20 @@
#include <malloc.h>
#include <cstdint>
#include <cstring>
#include <string>
#include <vector>
#include "MenuUtils.h" #include "MenuUtils.h"
#include "DrawUtils.h" #include "DrawUtils.h"
#include <cstdint>
#include <cstring>
#include <malloc.h>
#include <string>
#include <vector>
#include <coreinit/screen.h>
#include <coreinit/debug.h> #include <coreinit/debug.h>
#include <vpad/input.h> #include <coreinit/screen.h>
#include <gx2/state.h> #include <gx2/state.h>
#include <nn/act/client_cpp.h>
#include <memory> #include <memory>
#include <nn/act/client_cpp.h>
#include <vpad/input.h>
#include "icon_png.h"
#include "ACTAccountInfo.h" #include "ACTAccountInfo.h"
#include "icon_png.h"
#include "logger.h" #include "logger.h"
const char *menu_options[] = { const char *menu_options[] = {

View File

@ -1,12 +1,13 @@
#pragma once #pragma once
#include "ACTAccountInfo.h"
#include <cstdint> #include <cstdint>
#include <string>
#include <memory> #include <memory>
#include <nn/act.h> #include <nn/act.h>
#include <string>
#include <vector> #include <vector>
#include "ACTAccountInfo.h"
// clang-format off
#define COLOR_WHITE Color(0xffffffff) #define COLOR_WHITE Color(0xffffffff)
#define COLOR_BLACK Color(0, 0, 0, 255) #define COLOR_BLACK Color(0, 0, 0, 255)
#define COLOR_BACKGROUND COLOR_BLACK #define COLOR_BACKGROUND COLOR_BLACK
@ -15,6 +16,7 @@
#define COLOR_AUTOBOOT Color(0xaeea00ff) #define COLOR_AUTOBOOT Color(0xaeea00ff)
#define COLOR_BORDER Color(204, 204, 204, 255) #define COLOR_BORDER Color(204, 204, 204, 255)
#define COLOR_BORDER_HIGHLIGHTED Color(0x3478e4ff) #define COLOR_BORDER_HIGHLIGHTED Color(0x3478e4ff)
// clang-format on
enum { enum {
BOOT_OPTION_WII_U_MENU, BOOT_OPTION_WII_U_MENU,

View File

@ -1,20 +1,20 @@
#include <malloc.h> #include <malloc.h>
#include "BootUtils.h"
#include "QuickStartUtils.h" #include "QuickStartUtils.h"
#include "logger.h" #include "logger.h"
#include "BootUtils.h"
#include <coreinit/exit.h> #include <coreinit/exit.h>
#include <coreinit/thread.h>
#include <coreinit/memdefaultheap.h>
#include <coreinit/foreground.h> #include <coreinit/foreground.h>
#include <coreinit/memdefaultheap.h>
#include <coreinit/thread.h>
#include <nn/acp/title.h> #include <nn/acp/title.h>
#include <nn/act/client_cpp.h> #include <nn/act/client_cpp.h>
#include <nn/ccr/sys_caffeine.h> #include <nn/ccr/sys_caffeine.h>
#include <nn/sl.h> #include <nn/sl.h>
#include <sysapp/title.h>
#include <sysapp/launch.h>
#include <proc_ui/procui.h> #include <proc_ui/procui.h>
#include <sysapp/launch.h>
#include <sysapp/title.h>
extern "C" void __fini_wut(); extern "C" void __fini_wut();

View File

@ -6,8 +6,8 @@
#include <coreinit/thread.h> #include <coreinit/thread.h>
#include <coreinit/title.h> #include <coreinit/title.h>
#include <nn/spm.h>
#include <nn/acp/save.h> #include <nn/acp/save.h>
#include <nn/spm.h>
#include <nsysuhs/uhs.h> #include <nsysuhs/uhs.h>
#include <sysapp/title.h> #include <sysapp/title.h>
@ -56,8 +56,7 @@ static int numberUSBStorageDevicesConnected() {
UhsInterfaceProfile profiles[10]; UhsInterfaceProfile profiles[10];
UhsInterfaceFilter filter = { UhsInterfaceFilter filter = {
.match_params = MATCH_ANY .match_params = MATCH_ANY};
};
UHSStatus result; UHSStatus result;
if ((result = UhsQueryInterfaces(handle, &filter, profiles, 10)) <= UHS_STATUS_OK) { if ((result = UhsQueryInterfaces(handle, &filter, profiles, 10)) <= UHS_STATUS_OK) {
@ -141,4 +140,3 @@ void initExternalStorage() {
nn::spm::Finalize(); nn::spm::Finalize();
} }

View File

@ -3,8 +3,8 @@
#ifdef DEBUG #ifdef DEBUG
#include <stdint.h> #include <stdint.h>
#include <whb/log_cafe.h> #include <whb/log_cafe.h>
#include <whb/log_udp.h>
#include <whb/log_module.h> #include <whb/log_module.h>
#include <whb/log_udp.h>
uint32_t moduleLogInit = false; uint32_t moduleLogInit = false;
uint32_t cafeLogInit = false; uint32_t cafeLogInit = false;

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <whb/log.h>
#include <string.h> #include <string.h>
#include <whb/log.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -12,11 +12,13 @@ extern "C" {
#define __FILENAME_X__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__) #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 { \ #define DEBUG_FUNCTION_LINE(FMT, ARGS...) \
do { \
WHBLogPrintf("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \ WHBLogPrintf("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
} while (0) } while (0)
#define DEBUG_FUNCTION_LINE_WRITE(FMT, ARGS...)do { \ #define DEBUG_FUNCTION_LINE_WRITE(FMT, ARGS...) \
do { \
WHBLogWritef("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \ WHBLogWritef("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
} while (0) } while (0)
@ -35,4 +37,3 @@ void deinitLogging();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -1,12 +1,12 @@
#include "DrawUtils.h"
#include "QuickStartUtils.h"
#include "StorageUtils.h"
#include "logger.h"
#include <coreinit/debug.h>
#include <gx2/state.h>
#include <malloc.h> #include <malloc.h>
#include <string> #include <string>
#include <vpad/input.h> #include <vpad/input.h>
#include <coreinit/debug.h>
#include <gx2/state.h>
#include "StorageUtils.h"
#include "QuickStartUtils.h"
#include "DrawUtils.h"
#include "logger.h"
#include "BootUtils.h" #include "BootUtils.h"
#include "MenuUtils.h" #include "MenuUtils.h"