Format the code via clang-format

This commit is contained in:
Maschell 2022-02-04 16:25:44 +01:00
parent c21f9d8567
commit 2547c7edca
75 changed files with 637 additions and 554 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,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 ./source
build-binary:
runs-on: ubuntu-18.04
needs: clang-format
steps:
- uses: actions/checkout@v2
- name: build binary

View File

@ -1,16 +0,0 @@
name: Build binary
on:
push:
branches-ignore:
- master
jobs:
build-binary:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: build binary
run: |
docker build . -t builder
docker run --rm -v ${PWD}:/project builder make

View File

@ -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 ./source
build-binary:
runs-on: ubuntu-18.04
needs: clang-format
steps:
- uses: actions/checkout@v2
- name: build binary

View File

@ -1,4 +1,6 @@
# Wii U Plugin Loader Backend
[![CI-Release](https://github.com/wiiu-env/WiiUPluginLoaderBackend/actions/workflows/ci.yml/badge.svg)](https://github.com/wiiu-env/WiiUPluginLoaderBackend/actions/workflows/ci.yml)
# Wii U Plugin Loader Backend
This is the Backend for the [WiiUPluginSystem](https://github.com/Maschell/WiiUPluginSystem). Check out the readme for more information about the Plugin System.
## Usage
@ -46,6 +48,10 @@ docker run -it --rm -v ${PWD}:/project wiiupluginloaderbackend-builder make
docker run -it --rm -v ${PWD}:/project wiiupluginloaderbackend-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
- Maschell
- orboditilt

View File

@ -1,18 +1,18 @@
#include <memory.h>
#include <coreinit/cache.h>
#include <coreinit/dynload.h>
#include <coreinit/memdefaultheap.h>
#include <memory.h>
#include <memory>
#include "patcher/hooks_patcher_static.h"
#include "plugin/PluginContainer.h"
#include "plugin/PluginMetaInformationFactory.h"
#include "plugin/PluginInformationFactory.h"
#include "plugin/PluginMetaInformationFactory.h"
#include "utils/ElfUtils.h"
#include "PluginManagement.h"
#include "hooks.h"
#include "globals.h"
#include "hooks.h"
#include "utils/ElfUtils.h"
bool PluginManagement::doRelocation(const std::vector<std::shared_ptr<RelocationData>> &relocData, relocation_trampoline_entry_t *tramp_data, uint32_t tramp_length, uint32_t trampolineID) {
std::map<std::string, OSDynLoad_Module> moduleHandleCache;
@ -215,4 +215,3 @@ PluginManagement::loadPlugins(const std::vector<std::shared_ptr<PluginData>> &pl
}
return plugins;
}

View File

@ -1,11 +1,12 @@
#pragma once
#include "plugin/PluginContainer.h"
#include <common/plugin_defines.h>
#include <memory>
#include <vector>
class PluginManagement {
public:
static void doRelocations(const std::vector<std::shared_ptr<PluginContainer>> &plugins, relocation_trampoline_entry_t *trampData, uint32_t tramp_size);
static void memsetBSS(const std::vector<std::shared_ptr<PluginContainer>> &plugins);

View File

@ -17,8 +17,8 @@
#pragma once
#include <cstdint>
#include <cstddef>
#include <cstdint>
#include <wums/defines/dynamic_linking_defines.h>
#include <wums/defines/export_defines.h>
#include <wums/defines/relocation_defines.h>

View File

@ -17,12 +17,12 @@
#pragma once
#include <string>
#include <vector>
#include <optional>
#include <wups/config.h>
#include "WUPSConfigCategory.h"
#include "utils/logger.h"
#include <optional>
#include <string>
#include <vector>
#include <wups/config.h>
class WUPSConfig {
public:

View File

@ -17,10 +17,10 @@
#pragma once
#include "WUPSConfigItem.h"
#include <string>
#include <vector>
#include <wups/config.h>
#include "WUPSConfigItem.h"
class WUPSConfigCategory {
public:

View File

@ -1,7 +1,7 @@
#include "../utils/logger.h"
#include "WUPSConfigCategory.h"
#include <wums.h>
#include <wups/config.h>
#include "WUPSConfigCategory.h"
#include "../utils/logger.h"
int32_t WUPSConfigCategory_Create(WUPSConfigCategoryHandle *out, const char *name) {
if (name == nullptr || out == nullptr) {

View File

@ -1,7 +1,7 @@
#include "../utils/logger.h"
#include "WUPSConfig.h"
#include <wums.h>
#include <wups/config.h>
#include "WUPSConfig.h"
#include "../utils/logger.h"
int32_t WUPSConfig_Create(WUPSConfigHandle *out, const char *name) {
if (name == nullptr || out == nullptr) {

View File

@ -20,9 +20,9 @@
#include <string>
#include <vector>
#include <wups/config.h>
#include "utils/StringTools.h"
#include "utils/logger.h"
#include <wups/config.h>
class WUPSConfigItem {
public:

View File

@ -1,6 +1,6 @@
#include "WUPSConfigItem.h"
#include <wums.h>
#include <wups/config.h>
#include "WUPSConfigItem.h"
typedef uint32_t WUPSConfigItemHandle;

View File

@ -1,3 +1,4 @@
// clang-format off
/*
Copyright (C) 2001-2015 by Serge Lamikhov-Center

View File

@ -1,3 +1,4 @@
// clang-format off
/*
Copyright (C) 2001-2015 by Serge Lamikhov-Center

View File

@ -1,3 +1,4 @@
// clang-format off
/*
Copyright (C) 2001-2015 by Serge Lamikhov-Center

View File

@ -1,3 +1,4 @@
// clang-format off
/*
Copyright (C) 2001-2015 by Serge Lamikhov-Center

View File

@ -1,3 +1,4 @@
// clang-format off
/*
Copyright (C) 2001-2015 by Serge Lamikhov-Center

View File

@ -1,3 +1,4 @@
// clang-format off
/*
Copyright (C) 2001-2015 by Serge Lamikhov-Center

View File

@ -1,3 +1,4 @@
// clang-format off
/*
Copyright (C) 2001-2015 by Serge Lamikhov-Center

View File

@ -1,3 +1,4 @@
// clang-format off
/*
Copyright (C) 2001-2015 by Serge Lamikhov-Center

View File

@ -1,3 +1,4 @@
// clang-format off
/*
Copyright (C) 2001-2015 by Serge Lamikhov-Center

View File

@ -1,3 +1,4 @@
// clang-format off
/*
Copyright (C) 2001-2015 by Serge Lamikhov-Center

View File

@ -1,3 +1,4 @@
// clang-format off
/*
Copyright (C) 2001-2015 by Serge Lamikhov-Center

View File

@ -1,3 +1,4 @@
// clang-format off
/*
Copyright (C) 2001-2015 by Serge Lamikhov-Center

View File

@ -1,8 +1,8 @@
#include <cstdarg>
#include <cstdio>
#include <strings.h>
#include <fs/CFile.hpp>
#include <strings.h>
CFile::CFile() {
iFd = -1;
@ -170,5 +170,3 @@ int32_t CFile::fwrite(const char *format, ...) {
return result;
}

View File

@ -1,9 +1,9 @@
#pragma once
#include <cstdio>
#include <string>
#include <cstring>
#include <fcntl.h>
#include <string>
#include <unistd.h>
#include <wut_types.h>

View File

@ -24,14 +24,14 @@
* 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>

View File

@ -27,8 +27,8 @@
#ifndef ___DIRLIST_H_
#define ___DIRLIST_H_
#include <vector>
#include <string>
#include <vector>
#include <wut_types.h>
typedef struct {
@ -97,6 +97,7 @@ public:
Dirs = 0x02,
CheckSubfolders = 0x08,
};
protected:
// Internal parser
BOOL InternalLoadPath(std::string &path);

View File

@ -1,11 +1,11 @@
#include <malloc.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include "fs/FSUtils.h"
#include "fs/CFile.hpp"
#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) {
//! always initialze input
@ -139,4 +139,3 @@ int32_t FSUtils::saveBufferToFile(const char *path, void *buffer, uint32_t size)
file.close();
return written;
}

View File

@ -2,8 +2,8 @@
#include <wums.h>
#include "plugin/PluginContainer.h"
#include "common/plugin_defines.h"
#include "plugin/PluginContainer.h"
#include "utils/ConfigUtils.h"
extern plugin_information_t *gPluginInformation;

View File

@ -1,6 +1,6 @@
#include "hooks.h"
#include "utils/logger.h"
#include "utils/StorageUtils.h"
#include "utils/logger.h"
void CallHook(plugin_information_t *pluginInformation, wups_loader_hook_type_t hook_type) {
CallHookEx(pluginInformation, hook_type, -1);
@ -87,8 +87,7 @@ void CallHookEx(plugin_information_t *pluginInformation, wups_loader_hook_type_t
hook_type == WUPS_LOADER_HOOK_GET_CONFIG ||
hook_type == WUPS_LOADER_HOOK_CONFIG_CLOSED ||
hook_type == WUPS_LOADER_HOOK_RELEASE_FOREGROUND ||
hook_type == WUPS_LOADER_HOOK_ACQUIRED_FOREGROUND
) {
hook_type == WUPS_LOADER_HOOK_ACQUIRED_FOREGROUND) {
((void (*)())((uint32_t *) func_ptr))();
} else if (hook_type == WUPS_LOADER_HOOK_INIT_STORAGE) {
wups_loader_init_storage_args_t args;

View File

@ -1,7 +1,7 @@
#pragma once
#include <wups.h>
#include "common/plugin_defines.h"
#include <wups.h>
void CallHook(plugin_information_t *pluginInformation, wups_loader_hook_type_t hook_type);

View File

@ -1,18 +1,18 @@
#include <wums.h>
#include <coreinit/debug.h>
#include <coreinit/cache.h>
#include <coreinit/ios.h>
#include <coreinit/dynload.h>
#include <coreinit/memdefaultheap.h>
#include <memory>
#include "plugin/PluginContainer.h"
#include "globals.h"
#include "plugin/PluginDataFactory.h"
#include "plugin/PluginDataPersistence.h"
#include "plugin/PluginContainerPersistence.h"
#include "PluginManagement.h"
#include "globals.h"
#include "hooks.h"
#include "patcher/hooks_patcher_static.h"
#include "plugin/PluginContainer.h"
#include "plugin/PluginContainerPersistence.h"
#include "plugin/PluginDataFactory.h"
#include "plugin/PluginDataPersistence.h"
#include <coreinit/cache.h>
#include <coreinit/debug.h>
#include <coreinit/dynload.h>
#include <coreinit/ios.h>
#include <coreinit/memdefaultheap.h>
#include <memory>
#include <wums.h>
WUMS_MODULE_EXPORT_NAME("homebrew_wupsbackend");

View File

@ -1,13 +1,13 @@
#include "hooks_patcher_static.h"
#include <wups.h>
#include <vpad/input.h>
#include <padscore/wpad.h>
#include <coreinit/messagequeue.h>
#include <coreinit/core.h>
#include <coreinit/messagequeue.h>
#include <padscore/wpad.h>
#include <vpad/input.h>
#include <wups.h>
#include "../utils/ConfigUtils.h"
#include "../globals.h"
#include "../hooks.h"
#include "../utils/ConfigUtils.h"
uint8_t vpadPressCooldown = 0xFF;
bool configMenuOpened = false;

View File

@ -1,10 +1,10 @@
#pragma once
#include <wums/defines/dynamic_linking_defines.h>
#include "RelocationData.h"
#include <memory>
#include <string>
#include <vector>
#include <memory>
#include "RelocationData.h"
#include <wums/defines/dynamic_linking_defines.h>
class DynamicLinkingHelper {
public:

View File

@ -16,9 +16,9 @@
****************************************************************************/
#pragma once
#include <wups.h>
#include <string>
#include <function_patcher/fpatching_defines.h>
#include <string>
#include <wups.h>
class FunctionData {
@ -73,4 +73,3 @@ private:
void *replaceAddr = nullptr;
void *replaceCall = nullptr;
};

View File

@ -24,8 +24,7 @@ class FunctionSymbolData {
public:
FunctionSymbolData(const FunctionSymbolData &o2) = default;
FunctionSymbolData(std::string &name, void *address, uint32_t size) :
name(name),
FunctionSymbolData(std::string &name, void *address, uint32_t size) : name(name),
address(address),
size(size) {
}

View File

@ -17,8 +17,8 @@
#pragma once
#include <wups.h>
#include <string>
#include <wups.h>
class HookData {

View File

@ -17,9 +17,9 @@
#pragma once
#include "../utils/logger.h"
#include <string>
#include <utility>
#include "../utils/logger.h"
class ImportRPLInformation {

View File

@ -17,10 +17,10 @@
#pragma once
#include <memory>
#include "PluginData.h"
#include "PluginMetaInformation.h"
#include "PluginInformation.h"
#include "PluginMetaInformation.h"
#include <memory>
class PluginContainer {
public:

View File

@ -2,12 +2,12 @@
#include <memory>
#include "DynamicLinkingHelper.h"
#include "PluginContainer.h"
#include "PluginInformationFactory.h"
#include "PluginMetaInformationFactory.h"
#include "PluginContainerPersistence.h"
#include "PluginDataPersistence.h"
#include "DynamicLinkingHelper.h"
#include "PluginInformationFactory.h"
#include "PluginMetaInformationFactory.h"
bool PluginContainerPersistence::savePlugin(plugin_information_t *pluginInformation, const std::shared_ptr<PluginContainer> &plugin, MEMHeapHandle heapHandle) {
int32_t plugin_count = pluginInformation->number_used_plugins;

View File

@ -1,8 +1,8 @@
#include "PluginData.h"
#include <utility>
#include <malloc.h>
#include "../utils/logger.h"
#include <malloc.h>
#include <utility>
PluginData::PluginData(const PluginData &obj) {
this->buffer = obj.buffer;
@ -34,8 +34,7 @@ void PluginData::freeMemory() {
PluginData::PluginData(const std::vector<uint8_t> &buffer) : PluginData(buffer, nullptr, eMemTypeMEM2) {
}
PluginData::PluginData(const std::vector<uint8_t> &input, MEMHeapHandle heapHandle, eMemoryTypes memoryType) :
heapHandle(heapHandle),
PluginData::PluginData(const std::vector<uint8_t> &input, MEMHeapHandle heapHandle, eMemoryTypes memoryType) : heapHandle(heapHandle),
memoryType(memoryType),
length(input.size()) {
void *data_copy = nullptr;

View File

@ -17,10 +17,10 @@
#pragma once
#include <coreinit/memexpheap.h>
#include <malloc.h>
#include <optional>
#include <vector>
#include <malloc.h>
#include <coreinit/memexpheap.h>
#include "../elfio/elfio.hpp"

View File

@ -14,13 +14,13 @@
* 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 <fcntl.h>
#include <sys/stat.h>
#include <dirent.h>
#include <memory>
#include "PluginDataFactory.h"
#include "../utils/logger.h"
#include "../utils/StringTools.h"
#include "../utils/logger.h"
#include <dirent.h>
#include <fcntl.h>
#include <memory>
#include <sys/stat.h>
std::vector<std::shared_ptr<PluginData>> PluginDataFactory::loadDir(const std::string &path, MEMHeapHandle heapHandle) {

View File

@ -17,11 +17,12 @@
#pragma once
#include "PluginData.h"
#include <coreinit/memexpheap.h>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include <coreinit/memexpheap.h>
#include "PluginData.h"
class PluginDataFactory {
public:

View File

@ -1,6 +1,6 @@
#include <memory>
#include "../common/plugin_defines.h"
#include "PluginDataPersistence.h"
#include "../common/plugin_defines.h"
#include <memory>
bool PluginDataPersistence::save(plugin_data_t *pluginDataStruct, const std::shared_ptr<PluginData> &plugin) {
if (pluginDataStruct == nullptr) {

View File

@ -1,6 +1,8 @@
#pragma once
#include "../common/plugin_defines.h"
#include "PluginData.h"
#include <memory>
class PluginDataPersistence {

View File

@ -17,18 +17,18 @@
#pragma once
#include <map>
#include <set>
#include <optional>
#include <string>
#include <vector>
#include <memory>
#include "FunctionData.h"
#include "FunctionSymbolData.h"
#include "HookData.h"
#include "PluginMetaInformation.h"
#include "RelocationData.h"
#include "HookData.h"
#include "FunctionData.h"
#include "SectionInfo.h"
#include "FunctionSymbolData.h"
#include <map>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <vector>
struct FunctionSymbolDataComparator {
bool operator()(const std::shared_ptr<FunctionSymbolData> &lhs,

View File

@ -15,17 +15,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "PluginInformationFactory.h"
#include "../utils/ElfUtils.h"
#include "../utils/utils.h"
#include "PluginData.h"
#include <coreinit/cache.h>
#include <coreinit/memexpheap.h>
#include <map>
#include <memory>
#include <string>
#include <vector>
#include <map>
#include <coreinit/cache.h>
#include <coreinit/memexpheap.h>
#include <wups.h>
#include "PluginData.h"
#include "PluginInformationFactory.h"
#include "../utils/utils.h"
#include "../utils/ElfUtils.h"
using namespace ELFIO;

View File

@ -17,15 +17,15 @@
#pragma once
#include "../elfio/elfio.hpp"
#include "PluginContainer.h"
#include "PluginInformation.h"
#include <coreinit/memheap.h>
#include <map>
#include <optional>
#include <string>
#include <vector>
#include <map>
#include <coreinit/memheap.h>
#include <wums/defines/relocation_defines.h>
#include "PluginInformation.h"
#include "PluginContainer.h"
#include "../elfio/elfio.hpp"
class PluginInformationFactory {
public:

View File

@ -15,12 +15,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <sys/types.h>
#include <dirent.h>
#include <whb/file.h>
#include <memory>
#include "../utils/StringTools.h"
#include "PluginMetaInformationFactory.h"
#include "../utils/StringTools.h"
#include <dirent.h>
#include <memory>
#include <sys/types.h>
#include <whb/file.h>
using namespace ELFIO;

View File

@ -17,12 +17,12 @@
#pragma once
#include "PluginData.h"
#include "PluginMetaInformation.h"
#include <memory>
#include <optional>
#include <string>
#include <memory>
#include <vector>
#include "PluginMetaInformation.h"
#include "PluginData.h"
class PluginMetaInformationFactory {
public:

View File

@ -17,15 +17,15 @@
#pragma once
#include "ImportRPLInformation.h"
#include <memory>
#include <string>
#include <utility>
#include "ImportRPLInformation.h"
class RelocationData {
public:
RelocationData(const char type, size_t offset, int32_t addend, void *destination, std::string &name, std::shared_ptr<ImportRPLInformation> rplInfo) :
type(type),
RelocationData(const char type, size_t offset, int32_t addend, void *destination, std::string &name, std::shared_ptr<ImportRPLInformation> rplInfo) : type(type),
offset(offset),
addend(addend),
destination(destination),

View File

@ -22,8 +22,7 @@
class SectionInfo {
public:
SectionInfo(std::string &name, uint32_t address, uint32_t sectionSize) :
name(name),
SectionInfo(std::string &name, uint32_t address, uint32_t sectionSize) : name(name),
address(address),
sectionSize(sectionSize) {
}

View File

@ -1,17 +1,17 @@
#include "ConfigUtils.h"
#include "logger.h"
#include "../config/WUPSConfig.h"
#include "../globals.h"
#include "DrawUtils.h"
#include "logger.h"
#include <coreinit/screen.h>
#include <gx2/display.h>
#include <memory/mappedmemory.h>
#include <padscore/kpad.h>
#include <string>
#include <vector>
#include <coreinit/screen.h>
#include <memory/mappedmemory.h>
#include <vpad/input.h>
#include <padscore/kpad.h>
#include <gx2/display.h>
#define COLOR_BACKGROUND Color(238, 238, 238, 255)
#define COLOR_TEXT Color(51, 51, 51, 255)

View File

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

View File

@ -1,8 +1,8 @@
#include <cstring>
#include <coreinit/cache.h>
#include <cstring>
#include "utils/logger.h"
#include "ElfUtils.h"
#include "utils/logger.h"
// See https://github.com/decaf-emu/decaf-emu/blob/43366a34e7b55ab9d19b2444aeb0ccd46ac77dea/src/libdecaf/src/cafe/loader/cafe_loader_reloc.cpp#L144
bool ElfUtils::elfLinkOne(char type, size_t offset, int32_t addend, uint32_t destination, uint32_t symbol_addr, relocation_trampoline_entry_t *trampoline_data, uint32_t trampoline_data_length,

View File

@ -1,10 +1,10 @@
#include "StorageUtils.h"
#include <string>
#include "utils/logger.h"
#include "utils/json.hpp"
#include "fs/CFile.hpp"
#include "fs/FSUtils.h"
#include "utils/json.hpp"
#include "utils/logger.h"
static void processJson(wups_storage_item_t *items, nlohmann::json json) {
if (items == nullptr) {

View File

@ -23,14 +23,14 @@
*
* for WiiXplorer 2010
***************************************************************************/
#include <vector>
#include <string>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <wut_types.h>
#include <cstdio>
#include <string>
#include <utils/StringTools.h>
#include <vector>
#include <wut_types.h>
BOOL StringTools::EndsWith(const std::string &a, const std::string &b) {

View File

@ -26,8 +26,8 @@
#ifndef __STRING_TOOLS_H
#define __STRING_TOOLS_H
#include <vector>
#include <string>
#include <vector>
#include <wut_types.h>
class StringTools {
@ -86,4 +86,3 @@ public:
};
#endif /* __STRING_TOOLS_H */

View File

@ -1,15 +1,15 @@
#include <coreinit/cache.h>
#include "../plugin/PluginMetaInformationFactory.h"
#include "exports.h"
#include "../PluginManagement.h"
#include "../globals.h"
#include "../plugin/PluginContainer.h"
#include "../plugin/PluginContainerPersistence.h"
#include "../plugin/PluginDataFactory.h"
#include "../PluginManagement.h"
#include "../globals.h"
#include "../plugin/PluginDataPersistence.h"
#include "exports.h"
#include "../plugin/PluginMetaInformationFactory.h"
#include <coreinit/cache.h>
#include <wums.h>
void fillPluginInformation(plugin_information *out, const std::shared_ptr<PluginMetaInformation> &metaInformation) {
static void fillPluginInformation(plugin_information *out, const std::shared_ptr<PluginMetaInformation> &metaInformation) {
out->plugin_information_version = PLUGIN_INFORMATION_VERSION;
strncpy(out->author, metaInformation->getAuthor().c_str(), sizeof(out->author) - 1);
strncpy(out->buildTimestamp, metaInformation->getBuildTimestamp().c_str(), sizeof(out->buildTimestamp) - 1);

View File

@ -7,8 +7,6 @@
extern "C" {
#endif
void fillPluginInformation(plugin_information *out, PluginMetaInformation *metaInformation);
PluginBackendApiErrorType WUPSLoadAndLinkByDataHandle(const plugin_data_handle *plugin_data_handle_list, uint32_t plugin_data_handle_list_size);
PluginBackendApiErrorType WUPSDeletePluginContainer(const plugin_container_handle *handle_list, uint32_t handle_list_size);

View File

@ -1,3 +1,4 @@
// clang-format off
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++

View File

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

View File

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

View File

@ -1,11 +1,11 @@
#include <string.h>
#include <stdlib.h>
#include "utils/logger.h"
#include <malloc.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <whb/log.h>
#include "utils/logger.h"
// https://gist.github.com/ccbrown/9722406
void dumpHex(const void *data, size_t size) {

View File

@ -12,7 +12,8 @@ extern "C" {
typeof(x) _x = x; \
typeof(min) _min = min; \
typeof(max) _max = max; \
( ( ( _x ) < ( _min ) ) ? ( _min ) : ( ( _x ) > ( _max ) ) ? ( _max) : ( _x ) ); \
(((_x) < (_min)) ? (_min) : ((_x) > (_max)) ? (_max) \
: (_x)); \
})
#define DegToRad(a) ((a) *0.01745329252f)