Format the code via clang-format

This commit is contained in:
Maschell 2022-07-24 17:07:42 +02:00
parent 0c8f5afbb1
commit d9f6b0a237
33 changed files with 341 additions and 242 deletions

67
.clang-format Normal file
View File

@ -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

View File

@ -6,9 +6,16 @@ on:
- main - main
jobs: 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 ./source
build-binary: build-binary:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: clang-format
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Checkout submodules using a PAT - name: Checkout submodules using a PAT
@ -63,4 +70,4 @@ jobs:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip asset_path: ./${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip
asset_name: ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip asset_name: ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip
asset_content_type: application/unknown asset_content_type: application/zip

View File

@ -3,8 +3,34 @@ name: CI-PR
on: [pull_request] on: [pull_request]
jobs: 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 ./source
check-build-with-logging:
runs-on: ubuntu-18.04
needs: clang-format
steps:
- uses: actions/checkout@v2
- name: Checkout submodules using a PAT
run: |
git config --file .gitmodules --get-regexp url | while read url; do
git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/${{ secrets.CI_PAT }}:${{ secrets.CI_PAT }}@github.com\//")
done
git submodule sync
git submodule update --init --recursive
- name: build binary with logging
run: |
docker build . -t builder
docker run --rm -v ${PWD}:/project builder make DEBUG=VERBOSE
docker run --rm -v ${PWD}:/project builder make clean
docker run --rm -v ${PWD}:/project builder make DEBUG=1
build-binary: build-binary:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: clang-format
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Checkout submodules using a PAT - name: Checkout submodules using a PAT

View File

@ -1,10 +1,10 @@
#include "ApplicationState.h" #include "ApplicationState.h"
#include "utils/WiiUScreen.h" #include "../build/safe_payload.h"
#include "utils/ScreenUtils.h" #include "utils/ScreenUtils.h"
#include "utils/StringTools.h" #include "utils/StringTools.h"
#include "../build/safe_payload.h" #include "utils/WiiUScreen.h"
#include <sysapp/launch.h>
#include <iosuhax.h> #include <iosuhax.h>
#include <sysapp/launch.h>
extern "C" void OSShutdown(); extern "C" void OSShutdown();
@ -132,8 +132,7 @@ void ApplicationState::changeState(eGameState newState) {
} else if (this->state == STATE_BOOT_MENU) { } else if (this->state == STATE_BOOT_MENU) {
menu.addText("System is currently booting into: "); menu.addText("System is currently booting into: ");
std::string titleId = StringTools::strfmt("%ll016X", this->coldbootTitleId); std::string titleId = StringTools::strfmt("%ll016X", this->coldbootTitleId);
std::string titleName = this->coldbootTitle ? std::string titleName = this->coldbootTitle ? std::string(this->coldbootTitle->name) : "Unknown title";
std::string(this->coldbootTitle->name) : "Unknown title";
menu.addText(titleId + " (" + titleName + ")"); menu.addText(titleId + " (" + titleName + ")");
menu.addText(); menu.addText();
if (this->systemXMLRestorePossible && this->systemXMLAlreadyPatched) { if (this->systemXMLRestorePossible && this->systemXMLAlreadyPatched) {
@ -209,8 +208,7 @@ void ApplicationState::update(Input *input) {
changeState(STATE_INSTALL_FST); changeState(STATE_INSTALL_FST);
} }
} else if (this->state == STATE_INSTALL_FST) { } else if (this->state == STATE_INSTALL_FST) {
auto result = (this->fstAlreadyPatched) ? InstallerService::SUCCESS : auto result = (this->fstAlreadyPatched) ? InstallerService::SUCCESS : InstallerService::patchFST(this->appInfo->path, this->appInfo->fstHash);
InstallerService::patchFST(this->appInfo->path, this->appInfo->fstHash);
if (result != InstallerService::SUCCESS) { if (result != InstallerService::SUCCESS) {
this->installerError = result; this->installerError = result;
setError(ERROR_INSTALLER_ERROR); setError(ERROR_INSTALLER_ERROR);
@ -218,8 +216,7 @@ void ApplicationState::update(Input *input) {
changeState(STATE_INSTALL_COS); changeState(STATE_INSTALL_COS);
} }
} else if (this->state == STATE_INSTALL_COS) { } else if (this->state == STATE_INSTALL_COS) {
auto result = (this->cosAlreadyPatched) ? InstallerService::SUCCESS : auto result = (this->cosAlreadyPatched) ? InstallerService::SUCCESS : InstallerService::patchCOS(this->appInfo->path, this->appInfo->cosHash);
InstallerService::patchCOS(this->appInfo->path, this->appInfo->cosHash);
if (result != InstallerService::SUCCESS) { if (result != InstallerService::SUCCESS) {
this->installerError = result; this->installerError = result;
setError(ERROR_INSTALLER_ERROR); setError(ERROR_INSTALLER_ERROR);

View File

@ -1,15 +1,14 @@
#pragma once #pragma once
#include <string>
#include <optional>
#include <input/Input.h>
#include "common/common.h"
#include "InstallerService.h" #include "InstallerService.h"
#include "Menu.h" #include "Menu.h"
#include "common/common.h"
#include <input/Input.h>
#include <optional>
#include <string>
class ApplicationState { class ApplicationState {
public: public:
enum eErrorState { enum eErrorState {
ERROR_NONE, ERROR_NONE,
ERROR_IOSUHAX_FAILED, ERROR_IOSUHAX_FAILED,

View File

@ -1,19 +1,19 @@
#include "common/common.h"
#include "utils/logger.h"
#include "utils/WiiUScreen.h"
#include "utils/StringTools.h"
#include "fs/FSUtils.h"
#include "common/fst_structs.h"
#include "InstallerService.h" #include "InstallerService.h"
#include "utils/utils.h" #include "common/common.h"
#include "common/fst_structs.h"
#include "fs/FSUtils.h"
#include "utils/StringTools.h"
#include "utils/WiiUScreen.h"
#include "utils/logger.h"
#include "utils/pugixml.hpp" #include "utils/pugixml.hpp"
#include "utils/utils.h"
#include <coreinit/mcp.h> #include <coreinit/mcp.h>
#include <string>
#include <memory>
#include <cstdlib> #include <cstdlib>
#include <malloc.h>
#include <sstream>
#include <iosuhax.h> #include <iosuhax.h>
#include <malloc.h>
#include <memory>
#include <sstream>
#include <string>
InstallerService::eResults InstallerService::checkCOS(const std::string &path, char *hash) { InstallerService::eResults InstallerService::checkCOS(const std::string &path, char *hash) {
std::string cosFilePath = path + "/code/cos.xml"; std::string cosFilePath = path + "/code/cos.xml";
@ -137,7 +137,7 @@ bool InstallerService::patchCOSXMLData(pugi::xml_document *doc) {
appEntry.child("codegen_core").first_child().set_value("80000001"); appEntry.child("codegen_core").first_child().set_value("80000001");
appEntry.child("max_size").first_child().set_value("40000000"); appEntry.child("max_size").first_child().set_value("40000000");
appEntry.child("max_codesize").first_child().set_value("00800000"); appEntry.child("max_codesize").first_child().set_value("00800000");
for (pugi::xml_node permission: appEntry.child("permissions").children()) { for (pugi::xml_node permission : appEntry.child("permissions").children()) {
auto mask = permission.child("mask"); auto mask = permission.child("mask");
mask.first_child().set_value("FFFFFFFFFFFFFFFF"); mask.first_child().set_value("FFFFFFFFFFFFFFFF");
} }
@ -343,7 +343,6 @@ std::string InstallerService::ErrorMessage(InstallerService::eResults error) {
} else { } else {
return "UNKNOWN ERROR"; return "UNKNOWN ERROR";
} }
} }
bool InstallerService::isBackupAvailable(const std::string &path) { bool InstallerService::isBackupAvailable(const std::string &path) {
@ -353,7 +352,7 @@ bool InstallerService::isBackupAvailable(const std::string &path) {
{"/content/safe.rpx.bak"}, {"/content/safe.rpx.bak"},
}; };
for (auto &backupEntry: backupList) { for (auto &backupEntry : backupList) {
std::string backupFile = path + backupEntry; std::string backupFile = path + backupEntry;
std::string backupSha1 = backupFile + ".sha1"; std::string backupSha1 = backupFile + ".sha1";
@ -389,7 +388,7 @@ InstallerService::eResults InstallerService::restoreAppFiles(const std::string &
{"/code/safe.rpx", "/content/safe.rpx.bak"}, {"/code/safe.rpx", "/content/safe.rpx.bak"},
}; };
for (auto &backupOp: backupList) { for (auto &backupOp : backupList) {
std::string destPath = path + backupOp[0]; std::string destPath = path + backupOp[0];
std::string backupPath = path + backupOp[1]; std::string backupPath = path + backupOp[1];
@ -406,7 +405,7 @@ InstallerService::eResults InstallerService::restoreAppFiles(const std::string &
} }
} }
for (auto &backupOp: backupList) { for (auto &backupOp : backupList) {
std::string backupPath = path + backupOp[1]; std::string backupPath = path + backupOp[1];
std::string backupSha1Path = backupPath + ".sha1"; std::string backupSha1Path = backupPath + ".sha1";
::remove(backupPath.c_str()); ::remove(backupPath.c_str());
@ -424,7 +423,7 @@ InstallerService::eResults InstallerService::backupAppFiles(const std::string &p
{"/code/safe.rpx", "/content/safe.rpx.bak"}, {"/code/safe.rpx", "/content/safe.rpx.bak"},
}; };
for (auto &backupOp: backupList) { for (auto &backupOp : backupList) {
std::string backupSrc = path + backupOp[0]; std::string backupSrc = path + backupOp[0];
std::string backupDst = path + backupOp[1]; std::string backupDst = path + backupOp[1];
std::string backupSha1 = backupDst + ".sha1"; std::string backupSha1 = backupDst + ".sha1";
@ -789,4 +788,3 @@ InstallerService::eResults InstallerService::setBootTitle(uint64_t titleId) {
return SUCCESS; return SUCCESS;
} }

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "utils/pugixml.hpp"
#include "common/common.h" #include "common/common.h"
#include <optional> #include "utils/pugixml.hpp"
#include <coreinit/memorymap.h> #include <coreinit/memorymap.h>
#include <optional>
class InstallerService { class InstallerService {
public: public:

View File

@ -1,11 +1,12 @@
#pragma once #pragma once
#include <string> #include "input/Input.h"
#include <functional>
#include <utility>
#include <list>
#include "utils/WiiUScreen.h"
#include "utils/ScreenUtils.h" #include "utils/ScreenUtils.h"
#include "utils/WiiUScreen.h"
#include <functional>
#include <list>
#include <string>
#include <utility>
template<typename T> template<typename T>
class Menu { class Menu {
@ -45,7 +46,7 @@ public:
int selectedDist = selected; int selectedDist = selected;
WiiUScreen::clearScreen(); WiiUScreen::clearScreen();
printHeader(); printHeader();
for (auto &row: content) { for (auto &row : content) {
std::string cursor = ""; std::string cursor = "";
if (row.first) { if (row.first) {
cursor += (selectedDist--) ? " " : "> "; cursor += (selectedDist--) ? " " : "> ";

View File

@ -1,3 +1,4 @@
// clang-format off
#include "common.h" #include "common.h"
systemXMLInformation systemXMLHashInformation[] = { systemXMLInformation systemXMLHashInformation[] = {

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <cstdint>
#include <coreinit/mcp.h> #include <coreinit/mcp.h>
#include <cstdint>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -59,4 +59,3 @@ WUT_CHECK_OFFSET(FSTNodeEntry, 0x08, file.size);
WUT_CHECK_OFFSET(FSTNodeEntry, 0x0C, permission); WUT_CHECK_OFFSET(FSTNodeEntry, 0x0C, permission);
WUT_CHECK_OFFSET(FSTNodeEntry, 0x0E, sectionNumber); WUT_CHECK_OFFSET(FSTNodeEntry, 0x0E, sectionNumber);
WUT_CHECK_SIZE(FSTNodeEntry, 0x10); WUT_CHECK_SIZE(FSTNodeEntry, 0x10);

View File

@ -1,7 +1,7 @@
#include "CFile.hpp"
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <strings.h> #include <strings.h>
#include "CFile.hpp"
CFile::CFile() { CFile::CFile() {
iFd = -1; iFd = -1;
@ -169,5 +169,3 @@ int32_t CFile::fwrite(const char *format, ...) {
return result; return result;
} }

View File

@ -1,10 +1,10 @@
#ifndef CFILE_HPP_ #ifndef CFILE_HPP_
#define CFILE_HPP_ #define CFILE_HPP_
#include <stdio.h>
#include <string>
#include <string.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <unistd.h> #include <unistd.h>
#include <wut_types.h> #include <wut_types.h>

View File

@ -1,11 +1,11 @@
#include <malloc.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include "FSUtils.h" #include "FSUtils.h"
#include "CFile.hpp" #include "CFile.hpp"
#include "utils/logger.h" #include "utils/logger.h"
#include <fcntl.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
int32_t FSUtils::LoadFileToMem(const char *filepath, uint8_t **inbuffer, uint32_t *size) { int32_t FSUtils::LoadFileToMem(const char *filepath, uint8_t **inbuffer, uint32_t *size) {
//! always initialze input //! always initialze input
@ -171,4 +171,3 @@ int32_t FSUtils::saveBufferToFile(const char *path, const void *buffer, uint32_t
file.close(); file.close();
return written; return written;
} }

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <wut_types.h>
#include <string> #include <string>
#include <wut_types.h>
class FSUtils { class FSUtils {
public: public:

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include "Input.h"
class CombinedInput : public Input { class CombinedInput : public Input {
public: public:

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <cstring>
#include <cstdint> #include <cstdint>
#include <cstring>
class Input { class Input {
public: public:
@ -57,5 +57,4 @@ public:
PadData data{}; PadData data{};
PadData lastData{}; PadData lastData{};
}; };

View File

@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <vpad/input.h>
#include "Input.h" #include "Input.h"
#include <vpad/input.h>
class VPadInput : public Input { class VPadInput : public Input {
public: public:

View File

@ -16,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include "Input.h"
#include <padscore/kpad.h> #include <padscore/kpad.h>
#include <padscore/wpad.h> #include <padscore/wpad.h>
#include "Input.h"
class WPADInput : public Input { class WPADInput : public Input {
public: public:

View File

@ -1,20 +1,20 @@
#include <coreinit/debug.h> #include <coreinit/debug.h>
#include <whb/proc.h>
#include <whb/log.h> #include <whb/log.h>
#include <whb/log_udp.h> #include <whb/log_udp.h>
#include <whb/proc.h>
#include "InstallerService.h"
#include "utils/WiiUScreen.h"
#include <input/CombinedInput.h>
#include <input/VPADInput.h>
#include <input/WPADInput.h>
#include <iosuhax.h> #include <iosuhax.h>
#include <iosuhax_devoptab.h> #include <iosuhax_devoptab.h>
#include <string_view> #include <string_view>
#include <input/WPADInput.h>
#include <input/VPADInput.h>
#include <input/CombinedInput.h>
#include "utils/WiiUScreen.h"
#include "InstallerService.h"
#include "ApplicationState.h"
#include "../build/safe_payload.h" #include "../build/safe_payload.h"
#include "ApplicationState.h"
constexpr bool strings_equal(char const *a, char const *b) { constexpr bool strings_equal(char const *a, char const *b) {
return std::string_view(a) == b; return std::string_view(a) == b;
@ -38,8 +38,7 @@ int main_loop() {
WPAD_CHAN_0, WPAD_CHAN_0,
WPAD_CHAN_1, WPAD_CHAN_1,
WPAD_CHAN_2, WPAD_CHAN_2,
WPAD_CHAN_3 WPAD_CHAN_3};
};
if (sFSAFd < 0 || !sIosuhaxMount) { if (sFSAFd < 0 || !sIosuhaxMount) {
state.setError(ApplicationState::eErrorState::ERROR_IOSUHAX_FAILED); state.setError(ApplicationState::eErrorState::ERROR_IOSUHAX_FAILED);
@ -51,7 +50,7 @@ int main_loop() {
if (vpadInput.update(1280, 720)) { if (vpadInput.update(1280, 720)) {
baseInput.combine(vpadInput); baseInput.combine(vpadInput);
} }
for (auto &wpadInput: wpadInputs) { for (auto &wpadInput : wpadInputs) {
if (wpadInput.update(1280, 720)) { if (wpadInput.update(1280, 720)) {
baseInput.combine(wpadInput); baseInput.combine(wpadInput);
} }

View File

@ -14,8 +14,9 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <coreinit/screen.h>
#include "ScreenUtils.h" #include "ScreenUtils.h"
#include <coreinit/screen.h>
#include <stdint.h>
void ScreenUtils::printTextOnScreen(ConsoleScreenID screen, int x, int y, const char *msg) { void ScreenUtils::printTextOnScreen(ConsoleScreenID screen, int x, int y, const char *msg) {
if (!msg) { if (!msg) {

View File

@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include <stdint.h>
//! Defines the ID of a display usable with OSScreen. //! Defines the ID of a display usable with OSScreen.
typedef enum ConsoleScreenID { typedef enum ConsoleScreenID {

View File

@ -23,17 +23,16 @@
* *
* for WiiXplorer 2010 * for WiiXplorer 2010
***************************************************************************/ ***************************************************************************/
#include <vector>
#include <string>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <strings.h>
#include <wut_types.h>
#include <stdio.h>
#include "StringTools.h" #include "StringTools.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <strings.h>
#include <vector>
#include <wchar.h>
#include <wut_types.h>
BOOL StringTools::EndsWith(const std::string &a, const std::string &b) { BOOL StringTools::EndsWith(const std::string &a, const std::string &b) {
@ -214,8 +213,7 @@ bool StringTools::findStringIC(const std::string &strHaystack, const std::string
auto it = std::search( auto it = std::search(
strHaystack.begin(), strHaystack.end(), strHaystack.begin(), strHaystack.end(),
strNeedle.begin(), strNeedle.end(), strNeedle.begin(), strNeedle.end(),
[](char ch1, char ch2) { return std::toupper(ch1) == std::toupper(ch2); } [](char ch1, char ch2) { return std::toupper(ch1) == std::toupper(ch2); });
);
return (it != strHaystack.end()); return (it != strHaystack.end());
} }

View File

@ -25,11 +25,11 @@
***************************************************************************/ ***************************************************************************/
#pragma once #pragma once
#include <vector>
#include <string>
#include <wut_types.h>
#include <algorithm> #include <algorithm>
#include <cctype> #include <cctype>
#include <string>
#include <vector>
#include <wut_types.h>
class StringTools { class StringTools {
public: public:

View File

@ -1,3 +1,4 @@
// clang-format off
/* /*
* *
* TinySHA1 - a header only implementation of the SHA1 algorithm in C++. Based * TinySHA1 - a header only implementation of the SHA1 algorithm in C++. Based

View File

@ -3,23 +3,24 @@
#include <whb/log.h> #include <whb/log.h>
#include <whb/log_console.h> #include <whb/log_console.h>
#include <coreinit/memheap.h> #include "logger.h"
#include <coreinit/cache.h> #include <coreinit/cache.h>
#include <coreinit/memfrmheap.h> #include <coreinit/memfrmheap.h>
#include <coreinit/memheap.h>
#include <coreinit/memory.h> #include <coreinit/memory.h>
#include <coreinit/screen.h> #include <coreinit/screen.h>
#include <proc_ui/procui.h>
#include <cstring> #include <cstring>
#include "logger.h" #include <proc_ui/procui.h>
#define NUM_LINES (16) #define NUM_LINES (16)
#define LINE_LENGTH (128) #define LINE_LENGTH (128)
#define CONSOLE_FRAME_HEAP_TAG (0x000DECAF) #define CONSOLE_FRAME_HEAP_TAG (0x000DECAF)
#define PRINTF_BUFFER_LENGTH 2048 #define PRINTF_BUFFER_LENGTH 2048
#define DEBUG_CONSOLE_LOG(FMT, ARGS...)do { \ #define DEBUG_CONSOLE_LOG(FMT, ARGS...) \
DEBUG_FUNCTION_LINE(FMT, ## ARGS); \ do { \
WiiUScreen::drawLinef(FMT, ## ARGS); \ DEBUG_FUNCTION_LINE(FMT, ##ARGS); \
WiiUScreen::drawLinef(FMT, ##ARGS); \
} while (0) } while (0)

View File

@ -10,12 +10,14 @@ 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...) \
WHBLogPrintf("[%23s]%30s@L%04d: " FMT "",__FILENAME__,__FUNCTION__, __LINE__, ## ARGS); \ do { \
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...) \
WHBLogWritef("[%23s]%30s@L%04d: " FMT "",__FILENAME__,__FUNCTION__, __LINE__, ## ARGS); \ do { \
WHBLogWritef("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
} while (0); } while (0);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,3 +1,4 @@
// clang-format off
/** /**
* pugixml parser - version 1.10 * pugixml parser - version 1.10
* -------------------------------------------------------- * --------------------------------------------------------

View File

@ -1,3 +1,4 @@
// clang-format off
/** /**
* pugixml parser - version 1.10 * pugixml parser - version 1.10
* -------------------------------------------------------- * --------------------------------------------------------

View File

@ -1,3 +1,4 @@
// clang-format off
/** /**
* pugixml parser - version 1.10 * pugixml parser - version 1.10
* -------------------------------------------------------- * --------------------------------------------------------

View File

@ -1,10 +1,10 @@
#include <string.h>
#include <stddef.h>
#include <whb/log.h>
#include <fs/FSUtils.h>
#include "logger.h"
#include "utils.h" #include "utils.h"
#include "TinySHA1.hpp" #include "TinySHA1.hpp"
#include "logger.h"
#include <fs/FSUtils.h>
#include <stddef.h>
#include <string.h>
#include <whb/log.h>
// https://gist.github.com/ccbrown/9722406 // https://gist.github.com/ccbrown/9722406
void Utils::dumpHex(const void *data, size_t size) { void Utils::dumpHex(const void *data, size_t size) {

View File

@ -9,26 +9,27 @@ extern "C" {
#define LIMIT(x, min, max) \ #define LIMIT(x, min, max) \
({ \ ({ \
typeof( x ) _x = x; \ typeof(x) _x = x; \
typeof( min ) _min = min; \ typeof(min) _min = min; \
typeof( max ) _max = max; \ typeof(max) _max = max; \
( ( ( _x ) < ( _min ) ) ? ( _min ) : ( ( _x ) > ( _max ) ) ? ( _max) : ( _x ) ); \ (((_x) < (_min)) ? (_min) : ((_x) > (_max)) ? (_max) \
}) : (_x)); \
})
#define DegToRad(a) ( (a) * 0.01745329252f ) #define DegToRad(a) ((a) *0.01745329252f)
#define RadToDeg(a) ( (a) * 57.29577951f ) #define RadToDeg(a) ((a) *57.29577951f)
#define ALIGN4(x) (((x) + 3) & ~3) #define ALIGN4(x) (((x) + 3) & ~3)
#define ALIGN32(x) (((x) + 31) & ~31) #define ALIGN32(x) (((x) + 31) & ~31)
// those work only in powers of 2 // those work only in powers of 2
#define ROUNDDOWN(val, align) ((val) & ~(align-1)) #define ROUNDDOWN(val, align) ((val) & ~(align - 1))
#define ROUNDUP(val, align) ROUNDDOWN(((val) + (align-1)), align) #define ROUNDUP(val, align) ROUNDDOWN(((val) + (align - 1)), align)
#define le16(i) ((((uint16_t) ((i) & 0xFF)) << 8) | ((uint16_t) (((i) & 0xFF00) >> 8))) #define le16(i) ((((uint16_t) ((i) &0xFF)) << 8) | ((uint16_t) (((i) &0xFF00) >> 8)))
#define le32(i) ((((uint32_t)le16((i) & 0xFFFF)) << 16) | ((uint32_t)le16(((i) & 0xFFFF0000) >> 16))) #define le32(i) ((((uint32_t) le16((i) &0xFFFF)) << 16) | ((uint32_t) le16(((i) &0xFFFF0000) >> 16)))
#define le64(i) ((((uint64_t)le32((i) & 0xFFFFFFFFLL)) << 32) | ((uint64_t)le32(((i) & 0xFFFFFFFF00000000LL) >> 32))) #define le64(i) ((((uint64_t) le32((i) &0xFFFFFFFFLL)) << 32) | ((uint64_t) le32(((i) &0xFFFFFFFF00000000LL) >> 32)))
#ifdef __cplusplus #ifdef __cplusplus
} }