Skip to content

Commit

Permalink
Merge pull request #17 from wiiu-env/clang_format
Browse files Browse the repository at this point in the history
Format the code via clang-format [no-ci]
  • Loading branch information
Maschell authored Feb 3, 2022
2 parents 485d339 + 36bd858 commit 807f7ea
Show file tree
Hide file tree
Showing 37 changed files with 441 additions and 374 deletions.
67 changes: 67 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
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: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Never
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ on:
- master

jobs:
clang-format:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: clang-format
run: |
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./src
build-binary:
runs-on: ubuntu-18.04
needs: clang-format
steps:
- uses: actions/checkout@v2
- name: build binary
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ name: CI-PR
on: [pull_request]

jobs:
clang-format:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: clang-format
run: |
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./src
build-binary:
runs-on: ubuntu-18.04
needs: clang-format
steps:
- uses: actions/checkout@v2
- name: build binary
Expand Down
37 changes: 17 additions & 20 deletions src/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,29 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "Application.h"
#include "common/common.h"
#include "resources/Resources.h"
#include "utils/AsyncExecutor.h"
#include "utils/logger.h"
#include <coreinit/core.h>
#include <coreinit/foreground.h>
#include <coreinit/title.h>
#include <proc_ui/procui.h>
#include <sysapp/launch.h>
#include "Application.h"
#include "common/common.h"
#include <gui/FreeTypeGX.h>
#include <gui/VPadController.h>
#include <gui/WPadController.h>
#include "resources/Resources.h"
#include <gui/sounds/SoundHandler.hpp>
#include <gui/memory.h>
#include "utils/logger.h"
#include "utils/AsyncExecutor.h"
#include <gui/sounds/SoundHandler.hpp>
#include <proc_ui/procui.h>
#include <sysapp/launch.h>
#include <thread>

Application *Application::applicationInstance = nullptr;
bool Application::exitApplication = false;
bool Application::quitRequest = false;
bool Application::exitApplication = false;
bool Application::quitRequest = false;

Application::Application()
: CThread(CThread::eAttributeAffCore1 | CThread::eAttributePinnedAff, 0, 0x800000), bgMusic(nullptr), video(nullptr), mainWindow(nullptr), fontSystem(nullptr), exitCode(0) {
: CThread(CThread::eAttributeAffCore1 | CThread::eAttributePinnedAff, 0, 0x800000), bgMusic(nullptr), video(nullptr), mainWindow(nullptr), fontSystem(nullptr), exitCode(0) {
controller[0] = new VPadController(GuiTrigger::CHANNEL_1);
controller[1] = new WPadController(GuiTrigger::CHANNEL_2);
controller[2] = new WPadController(GuiTrigger::CHANNEL_3);
Expand All @@ -62,7 +62,7 @@ Application::~Application() {

DEBUG_FUNCTION_LINE("Destroy controller");

for (auto &i: controller) {
for (auto &i : controller) {
delete i;
}

Expand All @@ -88,15 +88,13 @@ int32_t Application::exec() {
}

void Application::quit(int32_t code) {
exitCode = code;
exitCode = code;
exitApplication = true;
quitRequest = true;
quitRequest = true;
}

void Application::fadeOut() {
GuiImage fadeOut(video->getTvWidth(), video->getTvHeight(), (GX2Color) {
0, 0, 0, 255
});
GuiImage fadeOut(video->getTvWidth(), video->getTvHeight(), (GX2Color){0, 0, 0, 255});

for (int32_t i = 0; i < 255; i += 10) {
if (i > 255)
Expand Down Expand Up @@ -138,7 +136,7 @@ bool Application::procUI() {
switch (ProcUIProcessMessages(true)) {
case PROCUI_STATUS_EXITING: {
DEBUG_FUNCTION_LINE("PROCUI_STATUS_EXITING");
exitCode = EXIT_SUCCESS;
exitCode = EXIT_SUCCESS;
exitApplication = true;
break;
}
Expand Down Expand Up @@ -185,7 +183,6 @@ bool Application::procUI() {
DEBUG_FUNCTION_LINE("Initialize main window");
mainWindow = new MainWindow(video->getTvWidth(), video->getTvHeight());
}

}
executeProcess = true;
}
Expand All @@ -212,7 +209,7 @@ void Application::executeThread() {
mainWindow->process();

//! Read out inputs
for (auto &i: controller) {
for (auto &i : controller) {
if (!i->update(video->getTvWidth(), video->getTvHeight()))
continue;

Expand Down
3 changes: 1 addition & 2 deletions src/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#define _APPLICATION_H

#include "menu/MainWindow.h"
#include <gui/video/CVideo.h>
#include "system/CThread.h"
#include <gui/video/CVideo.h>

// forward declaration
class FreeTypeGX;
Expand Down Expand Up @@ -77,7 +77,6 @@ class Application : public CThread {
GuiController *controller[5]{};
int exitCode;
BOOL sFromHBL = FALSE;

};

#endif //_APPLICATION_H
9 changes: 4 additions & 5 deletions src/common/common.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#ifndef COMMON_H
#define COMMON_H
#define COMMON_H

#ifdef __cplusplus
extern "C" {
#endif

#define LAUNCHIINE_VERSION "v0.1"
#define META_PATH "/meta"
#define LAUNCHIINE_VERSION "v0.1"
#define META_PATH "/meta"

#ifdef __cplusplus
}
#endif

#endif /* COMMON_H */

#endif /* COMMON_H */
10 changes: 5 additions & 5 deletions src/entry.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#include "Application.h"
#include "common/common.h"
#include "utils/logger.h"
#include <whb/log_cafe.h>
#include <whb/log_udp.h>
#include <whb/log_module.h>
#include "utils/logger.h"
#include "Application.h"
#include <whb/log_udp.h>

int32_t main(int32_t argc, char **argv) {
bool moduleInit;
bool cafeInit = false;
bool udpInit = false;
bool udpInit = false;

if (!(moduleInit = WHBLogModuleInit())) {
cafeInit = WHBLogCafeInit();
udpInit = WHBLogUdpInit();
udpInit = WHBLogUdpInit();
}
DEBUG_FUNCTION_LINE("Starting launchiine " LAUNCHIINE_VERSION "");

Expand Down
20 changes: 9 additions & 11 deletions src/fs/CFile.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

#include <fs/CFile.hpp>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <fs/CFile.hpp>

CFile::CFile() {
iFd = -1;
iFd = -1;
mem_file = nullptr;
filesize = 0;
pos = 0;
pos = 0;
}

CFile::CFile(const std::string &filepath, eOpenTypes mode) {
Expand All @@ -35,7 +35,7 @@ int32_t CFile::open(const std::string &filepath, eOpenTypes mode) {

switch (mode) {
default:
case ReadOnly: // file must exist
case ReadOnly: // file must exist
openMode = O_RDONLY;
break;
case WriteOnly: // file will be created / zerod
Expand Down Expand Up @@ -77,10 +77,10 @@ void CFile::close() {
if (iFd >= 0)
::close(iFd);

iFd = -1;
iFd = -1;
mem_file = nullptr;
filesize = 0;
pos = 0;
pos = 0;
}

int32_t CFile::read(uint8_t *ptr, size_t size) {
Expand Down Expand Up @@ -127,7 +127,7 @@ int32_t CFile::write(const uint8_t *ptr, size_t size) {
}

int32_t CFile::seek(long int offset, int32_t origin) {
int32_t ret = 0;
int32_t ret = 0;
int64_t newPos = pos;

if (origin == SEEK_SET) {
Expand Down Expand Up @@ -158,7 +158,7 @@ int32_t CFile::seek(long int offset, int32_t origin) {

int32_t CFile::fwrite(const char *format, ...) {
char tmp[512];
tmp[0] = 0;
tmp[0] = 0;
int32_t result = -1;

va_list va;
Expand All @@ -171,5 +171,3 @@ int32_t CFile::fwrite(const char *format, ...) {

return result;
}


4 changes: 2 additions & 2 deletions src/fs/CFile.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef CFILE_HPP_
#define CFILE_HPP_

#include <fcntl.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <fcntl.h>
#include <string>
#include <unistd.h>
#include <wut_types.h>

Expand Down
16 changes: 8 additions & 8 deletions src/fs/DirList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@
* DirList Class
* for WiiXplorer 2010
***************************************************************************/
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <strings.h>
#include <algorithm>
#include <sys/stat.h>
#include <sys/dirent.h>
#include <sys/stat.h>

#include <fs/DirList.h>
#include <utils/StringTools.h>

DirList::DirList() {
Flags = 0;
Flags = 0;
Filter = 0;
Depth = 0;
Depth = 0;
}

DirList::DirList(const std::string &path, const char *filter, uint32_t flags, uint32_t maxDepth) {
Expand All @@ -55,9 +55,9 @@ BOOL DirList::LoadPath(const std::string &folder, const char *filter, uint32_t f
if (folder.empty())
return false;

Flags = flags;
Flags = flags;
Filter = filter;
Depth = maxDepth;
Depth = maxDepth;

std::string folderpath(folder);
uint32_t length = folderpath.size();
Expand All @@ -82,14 +82,14 @@ BOOL DirList::InternalLoadPath(std::string &folderpath) {
return false;

struct dirent *dirent = nullptr;
DIR *dir = nullptr;
DIR *dir = nullptr;

dir = opendir(folderpath.c_str());
if (dir == nullptr)
return false;

while ((dirent = readdir(dir)) != 0) {
BOOL isDir = dirent->d_type & DT_DIR;
BOOL isDir = dirent->d_type & DT_DIR;
const char *filename = dirent->d_name;

if (isDir) {
Expand Down
Loading

0 comments on commit 807f7ea

Please sign in to comment.