mirror of
https://github.com/wiiu-env/region_free_plugin.git
synced 2024-11-24 12:29:17 +01:00
Format the code via clang-format
This commit is contained in:
parent
b75edb5863
commit
d493bc3424
67
.clang-format
Normal file
67
.clang-format
Normal 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
|
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@ -6,8 +6,16 @@ on:
|
||||
- main
|
||||
|
||||
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
|
||||
|
8
.github/workflows/pr.yml
vendored
8
.github/workflows/pr.yml
vendored
@ -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
|
||||
|
@ -1,3 +1,5 @@
|
||||
[![CI-Release](https://github.com/wiiu-env/region_free_plugin/actions/workflows/ci.yml/badge.svg)](https://github.com/wiiu-env/region_free_plugin/actions/workflows/ci.yml)
|
||||
|
||||
# Region Free Plugin
|
||||
|
||||
This plugin allows you to launch an title of an other region and / or force a language of an title.
|
||||
@ -44,3 +46,7 @@ docker run -it --rm -v ${PWD}:/project regionfree_plugin-builder make
|
||||
# make clean
|
||||
docker run -it --rm -v ${PWD}:/project regionfree_plugin-builder make clean
|
||||
```
|
||||
|
||||
## Format the code via docker
|
||||
|
||||
`docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./src -i`
|
@ -1,17 +1,17 @@
|
||||
#include "ConfigUtils.h"
|
||||
|
||||
#include "utils/logger.h"
|
||||
#include "DrawUtils.h"
|
||||
#include "utils/logger.h"
|
||||
|
||||
#include "globals.h"
|
||||
#include <coreinit/mcp.h>
|
||||
#include <coreinit/screen.h>
|
||||
#include <map>
|
||||
#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 <coreinit/mcp.h>
|
||||
#include <map>
|
||||
#include "globals.h"
|
||||
|
||||
#define COLOR_BACKGROUND Color(238, 238, 238, 255)
|
||||
#define COLOR_TEXT Color(51, 51, 51, 255)
|
||||
@ -311,7 +311,6 @@ void ConfigUtils::displayMenu() {
|
||||
DrawUtils::beginDraw();
|
||||
DrawUtils::clear(COLOR_BLACK);
|
||||
DrawUtils::endDraw();
|
||||
|
||||
}
|
||||
|
||||
void ConfigUtils::openConfigMenu() {
|
||||
@ -348,7 +347,7 @@ void ConfigUtils::openConfigMenu() {
|
||||
|
||||
DrawUtils::deinitFont();
|
||||
|
||||
error_exit:
|
||||
error_exit:
|
||||
|
||||
if (screenbuffer0) {
|
||||
MEMFreeToMappedMemory(screenbuffer0);
|
||||
|
@ -189,7 +189,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);
|
||||
@ -229,7 +230,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);
|
||||
|
51
src/main.cpp
51
src/main.cpp
@ -1,22 +1,22 @@
|
||||
#include <wups.h>
|
||||
#include <nn/acp.h>
|
||||
#include <coreinit/title.h>
|
||||
#include <coreinit/mcp.h>
|
||||
#include <coreinit/userconfig.h>
|
||||
#include <coreinit/filesystem.h>
|
||||
#include <sysapp/title.h>
|
||||
#include <coreinit/thread.h>
|
||||
#include "utils/logger.h"
|
||||
#include "ConfigUtils.h"
|
||||
#include <malloc.h>
|
||||
#include <cstdio>
|
||||
#include <wups/config/WUPSConfigItemMultipleValues.h>
|
||||
#include <map>
|
||||
#include <coreinit/screen.h>
|
||||
#include <vpad/input.h>
|
||||
#include <padscore/kpad.h>
|
||||
#include <wups/config/WUPSConfigItemBoolean.h>
|
||||
#include "globals.h"
|
||||
#include "utils/logger.h"
|
||||
#include <coreinit/filesystem.h>
|
||||
#include <coreinit/mcp.h>
|
||||
#include <coreinit/screen.h>
|
||||
#include <coreinit/thread.h>
|
||||
#include <coreinit/title.h>
|
||||
#include <coreinit/userconfig.h>
|
||||
#include <cstdio>
|
||||
#include <malloc.h>
|
||||
#include <map>
|
||||
#include <nn/acp.h>
|
||||
#include <padscore/kpad.h>
|
||||
#include <sysapp/title.h>
|
||||
#include <vpad/input.h>
|
||||
#include <wups.h>
|
||||
#include <wups/config/WUPSConfigItemBoolean.h>
|
||||
#include <wups/config/WUPSConfigItemMultipleValues.h>
|
||||
|
||||
WUPS_PLUGIN_NAME("Region Free Plugin");
|
||||
WUPS_PLUGIN_DESCRIPTION("Allows the user to load titles from other regions");
|
||||
@ -101,16 +101,17 @@ DECL_FUNCTION(int32_t, ACPGetTitleMetaXmlByDevice, uint32_t titleid_upper, uint3
|
||||
ON_FUNCTIONS_PATCHED() {
|
||||
MCPRegion real_product_area;
|
||||
auto real_product_area_valid = getRealProductArea(&real_product_area);
|
||||
if(real_product_area_valid){
|
||||
if(real_product_area == MCP_REGION_EUROPE){
|
||||
if (real_product_area_valid) {
|
||||
if (real_product_area == MCP_REGION_EUROPE) {
|
||||
gDefaultProductArea = MCP_REGION_EUROPE;
|
||||
gDefaultLanguage = gDefaultLangForEUR;
|
||||
gDefaultCountry = gDefaultCountryForEUR;
|
||||
} else if(real_product_area == MCP_REGION_JAPAN){
|
||||
} else if (real_product_area == MCP_REGION_JAPAN) {
|
||||
gDefaultProductArea = MCP_REGION_JAPAN;
|
||||
gDefaultLanguage = gDefaultLangForJPN;
|
||||
gDefaultCountry = gDefaultCountryForJPN;
|
||||
}if(real_product_area == MCP_REGION_USA){
|
||||
}
|
||||
if (real_product_area == MCP_REGION_USA) {
|
||||
gDefaultProductArea = MCP_REGION_USA;
|
||||
gDefaultLanguage = gDefaultLangForUSA;
|
||||
gDefaultCountry = gDefaultCountryForUSA;
|
||||
@ -372,7 +373,7 @@ void default_lang_changed(ConfigItemMultipleValues *item, uint32_t newValue) {
|
||||
|
||||
void getConfigInfoForLangMap(std::map<Lanuages, const char *> &curLangMap, ConfigItemMultipleValuesPair *pair, uint32_t default_lang, uint32_t *default_index, uint32_t *len) {
|
||||
uint32_t i = 0;
|
||||
for (auto &curEntry: curLangMap) {
|
||||
for (auto &curEntry : curLangMap) {
|
||||
if (default_lang == curEntry.first) {
|
||||
*default_index = i;
|
||||
}
|
||||
@ -411,8 +412,7 @@ WUPS_GET_CONFIG() {
|
||||
{LANG_ENGLISH, "English"},
|
||||
{LANG_FRANCAIS, "Francais"},
|
||||
{LANG_ESPANOL, "Espanol"},
|
||||
{LANG_PORTUGUES, "Portugues"}
|
||||
};
|
||||
{LANG_PORTUGUES, "Portugues"}};
|
||||
|
||||
ConfigItemMultipleValuesPair lang_eur_pair[eur_lang_map.size()];
|
||||
uint32_t number_lang_eur_values = 0;
|
||||
@ -543,7 +543,7 @@ static const uint64_t
|
||||
0x0005001010062100ull,
|
||||
0x0005001010062200ull,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
bool getRealProductArea(MCPRegion *out) {
|
||||
if (out == nullptr) {
|
||||
@ -587,4 +587,3 @@ WUPS_MUST_REPLACE(ACPGetLaunchMetaXml, WUPS_LOADER_LIBRARY_NN_ACP, ACPGetLaunchM
|
||||
WUPS_MUST_REPLACE(MCP_GetSysProdSettings, WUPS_LOADER_LIBRARY_COREINIT, MCP_GetSysProdSettings);
|
||||
WUPS_MUST_REPLACE(UCReadSysConfig, WUPS_LOADER_LIBRARY_COREINIT, UCReadSysConfig);
|
||||
WUPS_MUST_REPLACE(_SYSGetSystemApplicationTitleIdByProdArea, WUPS_LOADER_LIBRARY_SYSAPP, _SYSGetSystemApplicationTitleIdByProdArea);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <whb/log.h>
|
||||
#include <string.h>
|
||||
#include <whb/log.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -14,12 +14,14 @@ extern "C" {
|
||||
|
||||
#define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) while (0)
|
||||
|
||||
#define DEBUG_FUNCTION_LINE(FMT, ARGS...)do { \
|
||||
WHBLogPrintf("[%23s]%30s@L%04d: " FMT "",__FILENAME__,__FUNCTION__, __LINE__, ## ARGS); \
|
||||
#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 { \
|
||||
WHBLogWritef("[%23s]%30s@L%04d: " FMT "",__FILENAME__,__FUNCTION__, __LINE__, ## ARGS); \
|
||||
#define DEBUG_FUNCTION_LINE_WRITE(FMT, ARGS...) \
|
||||
do { \
|
||||
WHBLogWritef("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
@ -39,4 +41,3 @@ void deinitLogging();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user