mirror of
https://github.com/wiiu-env/region_free_plugin.git
synced 2024-11-21 19:09: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
|
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
@ -6,8 +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 ./src
|
||||||
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: build binary
|
- name: build binary
|
||||||
@ -26,7 +34,7 @@ jobs:
|
|||||||
id: get_repository_name
|
id: get_repository_name
|
||||||
run: |
|
run: |
|
||||||
echo REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//") >> $GITHUB_ENV
|
echo REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//") >> $GITHUB_ENV
|
||||||
echo DATETIME=$(echo $(date '+%Y%m%d-%H%M%S')) >> $GITHUB_ENV
|
echo DATETIME=$(echo $(date '+%Y%m%d-%H%M%S')) >> $GITHUB_ENV
|
||||||
- uses: actions/download-artifact@master
|
- uses: actions/download-artifact@master
|
||||||
with:
|
with:
|
||||||
name: binary
|
name: binary
|
||||||
|
8
.github/workflows/pr.yml
vendored
8
.github/workflows/pr.yml
vendored
@ -3,8 +3,16 @@ 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 ./src
|
||||||
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: build binary
|
- 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
|
# Region Free Plugin
|
||||||
|
|
||||||
This plugin allows you to launch an title of an other region and / or force a language of an title.
|
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
|
# make clean
|
||||||
docker run -it --rm -v ${PWD}:/project regionfree_plugin-builder 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,28 +1,28 @@
|
|||||||
#include "ConfigUtils.h"
|
#include "ConfigUtils.h"
|
||||||
|
|
||||||
#include "utils/logger.h"
|
|
||||||
#include "DrawUtils.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 <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <coreinit/screen.h>
|
|
||||||
#include <memory/mappedmemory.h>
|
|
||||||
#include <vpad/input.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_BACKGROUND Color(238, 238, 238, 255)
|
||||||
#define COLOR_TEXT Color(51, 51, 51, 255)
|
#define COLOR_TEXT Color(51, 51, 51, 255)
|
||||||
#define COLOR_TEXT2 Color(72, 72, 72, 255)
|
#define COLOR_TEXT2 Color(72, 72, 72, 255)
|
||||||
#define COLOR_DISABLED Color(255, 0, 0, 255)
|
#define COLOR_DISABLED Color(255, 0, 0, 255)
|
||||||
#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)
|
||||||
#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 MAX_BUTTONS_ON_SCREEN 8
|
#define MAX_BUTTONS_ON_SCREEN 8
|
||||||
|
|
||||||
static uint32_t remapWiiMoteButtons(uint32_t buttons) {
|
static uint32_t remapWiiMoteButtons(uint32_t buttons) {
|
||||||
uint32_t conv_buttons = 0;
|
uint32_t conv_buttons = 0;
|
||||||
@ -121,14 +121,14 @@ void ConfigUtils::displayMenu() {
|
|||||||
auto selectedBtn = 0;
|
auto selectedBtn = 0;
|
||||||
|
|
||||||
std::map<MCPRegion, const char *> region_map{
|
std::map<MCPRegion, const char *> region_map{
|
||||||
{MCP_REGION_JAPAN, "Japan"},
|
{MCP_REGION_JAPAN, "Japan"},
|
||||||
{MCP_REGION_USA, "USA"},
|
{MCP_REGION_USA, "USA"},
|
||||||
{MCP_REGION_EUROPE, "Europe"},
|
{MCP_REGION_EUROPE, "Europe"},
|
||||||
};
|
};
|
||||||
|
|
||||||
std::map<MCPRegion, int32_t> region_map_to_index{
|
std::map<MCPRegion, int32_t> region_map_to_index{
|
||||||
{MCP_REGION_JAPAN, 0},
|
{MCP_REGION_JAPAN, 0},
|
||||||
{MCP_REGION_USA, 1},
|
{MCP_REGION_USA, 1},
|
||||||
{MCP_REGION_EUROPE, 2},
|
{MCP_REGION_EUROPE, 2},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -143,26 +143,26 @@ void ConfigUtils::displayMenu() {
|
|||||||
DEBUG_FUNCTION_LINE("Current %d", curSelectedRegion);
|
DEBUG_FUNCTION_LINE("Current %d", curSelectedRegion);
|
||||||
|
|
||||||
std::map<Lanuages, const char *> lang_map{
|
std::map<Lanuages, const char *> lang_map{
|
||||||
{LANG_JAPANESE, "Japanese"},
|
{LANG_JAPANESE, "Japanese"},
|
||||||
{LANG_ENGLISH, "English"},
|
{LANG_ENGLISH, "English"},
|
||||||
{LANG_FRANCAIS, "Francais"},
|
{LANG_FRANCAIS, "Francais"},
|
||||||
{LANG_DEUTSCH, "Deutsch"},
|
{LANG_DEUTSCH, "Deutsch"},
|
||||||
{LANG_ITALIANO, "Italiano"},
|
{LANG_ITALIANO, "Italiano"},
|
||||||
{LANG_ESPANOL, "Espanol"},
|
{LANG_ESPANOL, "Espanol"},
|
||||||
{LANG_NEDERLANDS, "Nederlands"},
|
{LANG_NEDERLANDS, "Nederlands"},
|
||||||
{LANG_PORTUGUES, "Portugues"},
|
{LANG_PORTUGUES, "Portugues"},
|
||||||
{LANG_RUSSKI, "Russki"},
|
{LANG_RUSSKI, "Russki"},
|
||||||
};
|
};
|
||||||
std::map<Lanuages, int32_t> lang_map_to_index{
|
std::map<Lanuages, int32_t> lang_map_to_index{
|
||||||
{LANG_JAPANESE, 0},
|
{LANG_JAPANESE, 0},
|
||||||
{LANG_ENGLISH, 1},
|
{LANG_ENGLISH, 1},
|
||||||
{LANG_FRANCAIS, 2},
|
{LANG_FRANCAIS, 2},
|
||||||
{LANG_DEUTSCH, 3},
|
{LANG_DEUTSCH, 3},
|
||||||
{LANG_ITALIANO, 4},
|
{LANG_ITALIANO, 4},
|
||||||
{LANG_ESPANOL, 5},
|
{LANG_ESPANOL, 5},
|
||||||
{LANG_NEDERLANDS, 6},
|
{LANG_NEDERLANDS, 6},
|
||||||
{LANG_PORTUGUES, 7},
|
{LANG_PORTUGUES, 7},
|
||||||
{LANG_RUSSKI, 8},
|
{LANG_RUSSKI, 8},
|
||||||
};
|
};
|
||||||
std::map<int32_t, Lanuages> lang_index_to_map{
|
std::map<int32_t, Lanuages> lang_index_to_map{
|
||||||
{0, LANG_JAPANESE},
|
{0, LANG_JAPANESE},
|
||||||
@ -179,16 +179,16 @@ void ConfigUtils::displayMenu() {
|
|||||||
auto curSelectedLanguage = gCurrentLanguage;
|
auto curSelectedLanguage = gCurrentLanguage;
|
||||||
|
|
||||||
int32_t curRegionIndex = region_map_to_index[curSelectedRegion];
|
int32_t curRegionIndex = region_map_to_index[curSelectedRegion];
|
||||||
int32_t curLangIndex = lang_map_to_index[curSelectedLanguage];
|
int32_t curLangIndex = lang_map_to_index[curSelectedLanguage];
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
buttonsTriggered = 0;
|
buttonsTriggered = 0;
|
||||||
buttonsReleased = 0;
|
buttonsReleased = 0;
|
||||||
|
|
||||||
VPADRead(VPAD_CHAN_0, &vpad_data, 1, &vpad_error);
|
VPADRead(VPAD_CHAN_0, &vpad_data, 1, &vpad_error);
|
||||||
if (vpad_error == VPAD_READ_SUCCESS) {
|
if (vpad_error == VPAD_READ_SUCCESS) {
|
||||||
buttonsTriggered = vpad_data.trigger;
|
buttonsTriggered = vpad_data.trigger;
|
||||||
buttonsReleased = vpad_data.release;
|
buttonsReleased = vpad_data.release;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
@ -238,7 +238,7 @@ void ConfigUtils::displayMenu() {
|
|||||||
curRegionIndex = region_map.size() - 1;
|
curRegionIndex = region_map.size() - 1;
|
||||||
}
|
}
|
||||||
gCurrentProductArea = region_index_to_map[curRegionIndex];
|
gCurrentProductArea = region_index_to_map[curRegionIndex];
|
||||||
curSelectedRegion = gCurrentProductArea;
|
curSelectedRegion = gCurrentProductArea;
|
||||||
} else if (selectedBtn == 1) {
|
} else if (selectedBtn == 1) {
|
||||||
if (buttonsTriggered & VPAD_BUTTON_LEFT) {
|
if (buttonsTriggered & VPAD_BUTTON_LEFT) {
|
||||||
curLangIndex--;
|
curLangIndex--;
|
||||||
@ -253,7 +253,7 @@ void ConfigUtils::displayMenu() {
|
|||||||
if (curLangIndex >= lang_map.size()) {
|
if (curLangIndex >= lang_map.size()) {
|
||||||
curLangIndex = lang_map.size() - 1;
|
curLangIndex = lang_map.size() - 1;
|
||||||
}
|
}
|
||||||
gCurrentLanguage = lang_index_to_map[curLangIndex];
|
gCurrentLanguage = lang_index_to_map[curLangIndex];
|
||||||
curSelectedLanguage = gCurrentLanguage;
|
curSelectedLanguage = gCurrentLanguage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +311,6 @@ void ConfigUtils::displayMenu() {
|
|||||||
DrawUtils::beginDraw();
|
DrawUtils::beginDraw();
|
||||||
DrawUtils::clear(COLOR_BLACK);
|
DrawUtils::clear(COLOR_BLACK);
|
||||||
DrawUtils::endDraw();
|
DrawUtils::endDraw();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigUtils::openConfigMenu() {
|
void ConfigUtils::openConfigMenu() {
|
||||||
@ -319,8 +318,8 @@ void ConfigUtils::openConfigMenu() {
|
|||||||
|
|
||||||
uint32_t screen_buf0_size = OSScreenGetBufferSizeEx(SCREEN_TV);
|
uint32_t screen_buf0_size = OSScreenGetBufferSizeEx(SCREEN_TV);
|
||||||
uint32_t screen_buf1_size = OSScreenGetBufferSizeEx(SCREEN_DRC);
|
uint32_t screen_buf1_size = OSScreenGetBufferSizeEx(SCREEN_DRC);
|
||||||
void *screenbuffer0 = MEMAllocFromMappedMemoryForGX2Ex(screen_buf0_size, 0x100);
|
void *screenbuffer0 = MEMAllocFromMappedMemoryForGX2Ex(screen_buf0_size, 0x100);
|
||||||
void *screenbuffer1 = MEMAllocFromMappedMemoryForGX2Ex(screen_buf1_size, 0x100);
|
void *screenbuffer1 = MEMAllocFromMappedMemoryForGX2Ex(screen_buf1_size, 0x100);
|
||||||
|
|
||||||
if (!screenbuffer0 || !screenbuffer1) {
|
if (!screenbuffer0 || !screenbuffer1) {
|
||||||
DEBUG_FUNCTION_LINE("Failed to alloc buffers");
|
DEBUG_FUNCTION_LINE("Failed to alloc buffers");
|
||||||
@ -348,7 +347,7 @@ void ConfigUtils::openConfigMenu() {
|
|||||||
|
|
||||||
DrawUtils::deinitFont();
|
DrawUtils::deinitFont();
|
||||||
|
|
||||||
error_exit:
|
error_exit:
|
||||||
|
|
||||||
if (screenbuffer0) {
|
if (screenbuffer0) {
|
||||||
MEMFreeToMappedMemory(screenbuffer0);
|
MEMFreeToMappedMemory(screenbuffer0);
|
||||||
|
@ -6,26 +6,26 @@
|
|||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
|
|
||||||
// buffer width
|
// buffer width
|
||||||
#define TV_WIDTH 0x500
|
#define TV_WIDTH 0x500
|
||||||
#define DRC_WIDTH 0x380
|
#define DRC_WIDTH 0x380
|
||||||
|
|
||||||
bool DrawUtils::isBackBuffer;
|
bool DrawUtils::isBackBuffer;
|
||||||
|
|
||||||
uint8_t *DrawUtils::tvBuffer = nullptr;
|
uint8_t *DrawUtils::tvBuffer = nullptr;
|
||||||
uint32_t DrawUtils::tvSize = 0;
|
uint32_t DrawUtils::tvSize = 0;
|
||||||
uint8_t *DrawUtils::drcBuffer = nullptr;
|
uint8_t *DrawUtils::drcBuffer = nullptr;
|
||||||
uint32_t DrawUtils::drcSize = 0;
|
uint32_t DrawUtils::drcSize = 0;
|
||||||
|
|
||||||
// Don't put those into the clase or we have to include ft everywhere
|
// Don't put those into the clase or we have to include ft everywhere
|
||||||
static FT_Library ft_lib = nullptr;
|
static FT_Library ft_lib = nullptr;
|
||||||
static FT_Face ft_face = nullptr;
|
static FT_Face ft_face = nullptr;
|
||||||
static Color font_col(0xFFFFFFFF);
|
static Color font_col(0xFFFFFFFF);
|
||||||
|
|
||||||
void DrawUtils::initBuffers(void *tvBuffer_, uint32_t tvSize_, void *drcBuffer_, uint32_t drcSize_) {
|
void DrawUtils::initBuffers(void *tvBuffer_, uint32_t tvSize_, void *drcBuffer_, uint32_t drcSize_) {
|
||||||
DrawUtils::tvBuffer = (uint8_t *) tvBuffer_;
|
DrawUtils::tvBuffer = (uint8_t *) tvBuffer_;
|
||||||
DrawUtils::tvSize = tvSize_;
|
DrawUtils::tvSize = tvSize_;
|
||||||
DrawUtils::drcBuffer = (uint8_t *) drcBuffer_;
|
DrawUtils::drcBuffer = (uint8_t *) drcBuffer_;
|
||||||
DrawUtils::drcSize = drcSize_;
|
DrawUtils::drcSize = drcSize_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawUtils::beginDraw() {
|
void DrawUtils::beginDraw() {
|
||||||
@ -67,11 +67,11 @@ void DrawUtils::drawPixel(uint32_t x, uint32_t y, uint8_t r, uint8_t g, uint8_t
|
|||||||
i += drcSize / 2;
|
i += drcSize / 2;
|
||||||
}
|
}
|
||||||
if (a == 0xFF) {
|
if (a == 0xFF) {
|
||||||
drcBuffer[i] = r;
|
drcBuffer[i] = r;
|
||||||
drcBuffer[i + 1] = g;
|
drcBuffer[i + 1] = g;
|
||||||
drcBuffer[i + 2] = b;
|
drcBuffer[i + 2] = b;
|
||||||
} else {
|
} else {
|
||||||
drcBuffer[i] = r * opacity + drcBuffer[i] * (1 - opacity);
|
drcBuffer[i] = r * opacity + drcBuffer[i] * (1 - opacity);
|
||||||
drcBuffer[i + 1] = g * opacity + drcBuffer[i + 1] * (1 - opacity);
|
drcBuffer[i + 1] = g * opacity + drcBuffer[i + 1] * (1 - opacity);
|
||||||
drcBuffer[i + 2] = b * opacity + drcBuffer[i + 2] * (1 - opacity);
|
drcBuffer[i + 2] = b * opacity + drcBuffer[i + 2] * (1 - opacity);
|
||||||
}
|
}
|
||||||
@ -86,11 +86,11 @@ void DrawUtils::drawPixel(uint32_t x, uint32_t y, uint8_t r, uint8_t g, uint8_t
|
|||||||
i += tvSize / 2;
|
i += tvSize / 2;
|
||||||
}
|
}
|
||||||
if (a == 0xFF) {
|
if (a == 0xFF) {
|
||||||
tvBuffer[i] = r;
|
tvBuffer[i] = r;
|
||||||
tvBuffer[i + 1] = g;
|
tvBuffer[i + 1] = g;
|
||||||
tvBuffer[i + 2] = b;
|
tvBuffer[i + 2] = b;
|
||||||
} else {
|
} else {
|
||||||
tvBuffer[i] = r * opacity + tvBuffer[i] * (1 - opacity);
|
tvBuffer[i] = r * opacity + tvBuffer[i] * (1 - opacity);
|
||||||
tvBuffer[i + 1] = g * opacity + tvBuffer[i + 1] * (1 - opacity);
|
tvBuffer[i + 1] = g * opacity + tvBuffer[i + 1] * (1 - opacity);
|
||||||
tvBuffer[i + 2] = b * opacity + tvBuffer[i + 2] * (1 - opacity);
|
tvBuffer[i + 2] = b * opacity + tvBuffer[i + 2] * (1 - opacity);
|
||||||
}
|
}
|
||||||
@ -121,8 +121,8 @@ void DrawUtils::drawBitmap(uint32_t x, uint32_t y, uint32_t target_width, uint32
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t dataPos = __builtin_bswap32(*(uint32_t *) &(data[0x0A]));
|
uint32_t dataPos = __builtin_bswap32(*(uint32_t *) &(data[0x0A]));
|
||||||
uint32_t width = __builtin_bswap32(*(uint32_t *) &(data[0x12]));
|
uint32_t width = __builtin_bswap32(*(uint32_t *) &(data[0x12]));
|
||||||
uint32_t height = __builtin_bswap32(*(uint32_t *) &(data[0x16]));
|
uint32_t height = __builtin_bswap32(*(uint32_t *) &(data[0x16]));
|
||||||
|
|
||||||
if (dataPos == 0) {
|
if (dataPos == 0) {
|
||||||
dataPos = 54;
|
dataPos = 54;
|
||||||
@ -141,7 +141,7 @@ void DrawUtils::drawBitmap(uint32_t x, uint32_t y, uint32_t target_width, uint32
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DrawUtils::initFont() {
|
void DrawUtils::initFont() {
|
||||||
void *font = nullptr;
|
void *font = nullptr;
|
||||||
uint32_t size = 0;
|
uint32_t size = 0;
|
||||||
OSGetSharedData(OS_SHAREDDATATYPE_FONT_STANDARD, 0, &font, &size);
|
OSGetSharedData(OS_SHAREDDATATYPE_FONT_STANDARD, 0, &font, &size);
|
||||||
|
|
||||||
@ -189,7 +189,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);
|
||||||
@ -198,7 +199,7 @@ void DrawUtils::print(uint32_t x, uint32_t y, const char *string, bool alignRigh
|
|||||||
|
|
||||||
void DrawUtils::print(uint32_t x, uint32_t y, const wchar_t *string, bool alignRight) {
|
void DrawUtils::print(uint32_t x, uint32_t y, const wchar_t *string, bool alignRight) {
|
||||||
FT_GlyphSlot slot = ft_face->glyph;
|
FT_GlyphSlot slot = ft_face->glyph;
|
||||||
FT_Vector pen = {(int) x, (int) y};
|
FT_Vector pen = {(int) x, (int) y};
|
||||||
|
|
||||||
if (alignRight) {
|
if (alignRight) {
|
||||||
pen.x -= getTextWidth(string);
|
pen.x -= getTextWidth(string);
|
||||||
@ -229,7 +230,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);
|
||||||
@ -240,7 +242,7 @@ uint32_t DrawUtils::getTextWidth(const char *string) {
|
|||||||
|
|
||||||
uint32_t DrawUtils::getTextWidth(const wchar_t *string) {
|
uint32_t DrawUtils::getTextWidth(const wchar_t *string) {
|
||||||
FT_GlyphSlot slot = ft_face->glyph;
|
FT_GlyphSlot slot = ft_face->glyph;
|
||||||
uint32_t width = 0;
|
uint32_t width = 0;
|
||||||
|
|
||||||
for (; *string; string++) {
|
for (; *string; string++) {
|
||||||
FT_Load_Glyph(ft_face, FT_Get_Char_Index(ft_face, *string), FT_LOAD_BITMAP_METRICS_ONLY);
|
FT_Load_Glyph(ft_face, FT_Get_Char_Index(ft_face, *string), FT_LOAD_BITMAP_METRICS_ONLY);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
// visible screen sizes
|
// visible screen sizes
|
||||||
#define SCREEN_WIDTH 854
|
#define SCREEN_WIDTH 854
|
||||||
#define SCREEN_HEIGHT 480
|
#define SCREEN_HEIGHT 480
|
||||||
|
|
||||||
union Color {
|
union Color {
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
|
||||||
int gPreferSystemSettings = 1;
|
int gPreferSystemSettings = 1;
|
||||||
int gAutoDetection = 1;
|
int gAutoDetection = 1;
|
||||||
int gForceSettingsEnabled = 0;
|
int gForceSettingsEnabled = 0;
|
||||||
Lanuages gDefaultLanguage = LANG_ENGLISH;
|
Lanuages gDefaultLanguage = LANG_ENGLISH;
|
||||||
int32_t gDefaultCountry = 78;
|
int32_t gDefaultCountry = 78;
|
||||||
MCPRegion gDefaultProductArea = MCP_REGION_EUROPE;
|
MCPRegion gDefaultProductArea = MCP_REGION_EUROPE;
|
||||||
|
|
||||||
Lanuages gCurrentLanguage = gDefaultLanguage;
|
Lanuages gCurrentLanguage = gDefaultLanguage;
|
||||||
int32_t gCurrentCountry = gDefaultCountry;
|
int32_t gCurrentCountry = gDefaultCountry;
|
||||||
MCPRegion gCurrentProductArea = gDefaultProductArea;
|
MCPRegion gCurrentProductArea = gDefaultProductArea;
|
||||||
|
|
||||||
Lanuages gDefaultLangForEUR = LANG_ENGLISH;
|
Lanuages gDefaultLangForEUR = LANG_ENGLISH;
|
||||||
int32_t gDefaultCountryForEUR = 110;
|
int32_t gDefaultCountryForEUR = 110;
|
||||||
Lanuages gDefaultLangForUSA = LANG_ENGLISH;
|
Lanuages gDefaultLangForUSA = LANG_ENGLISH;
|
||||||
int32_t gDefaultCountryForUSA = 49;
|
int32_t gDefaultCountryForUSA = 49;
|
||||||
Lanuages gDefaultLangForJPN = LANG_JAPANESE;
|
Lanuages gDefaultLangForJPN = LANG_JAPANESE;
|
||||||
int32_t gDefaultCountryForJPN = 1;
|
int32_t gDefaultCountryForJPN = 1;
|
@ -5,15 +5,15 @@
|
|||||||
extern int gForceSettingsEnabled;
|
extern int gForceSettingsEnabled;
|
||||||
|
|
||||||
enum Lanuages {
|
enum Lanuages {
|
||||||
LANG_JAPANESE = 0,
|
LANG_JAPANESE = 0,
|
||||||
LANG_ENGLISH = 1,
|
LANG_ENGLISH = 1,
|
||||||
LANG_FRANCAIS = 2,
|
LANG_FRANCAIS = 2,
|
||||||
LANG_DEUTSCH = 3,
|
LANG_DEUTSCH = 3,
|
||||||
LANG_ESPANOL = 5,
|
LANG_ESPANOL = 5,
|
||||||
LANG_ITALIANO = 4,
|
LANG_ITALIANO = 4,
|
||||||
LANG_NEDERLANDS = 8,
|
LANG_NEDERLANDS = 8,
|
||||||
LANG_PORTUGUES = 9,
|
LANG_PORTUGUES = 9,
|
||||||
LANG_RUSSKI = 10,
|
LANG_RUSSKI = 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
291
src/main.cpp
291
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 "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 "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_NAME("Region Free Plugin");
|
||||||
WUPS_PLUGIN_DESCRIPTION("Allows the user to load titles from other regions");
|
WUPS_PLUGIN_DESCRIPTION("Allows the user to load titles from other regions");
|
||||||
@ -63,29 +63,29 @@ DECL_FUNCTION(int, UCReadSysConfig, int IOHandle, int count, struct UCSysConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
ON_APPLICATION_ENDS() {
|
ON_APPLICATION_ENDS() {
|
||||||
gCurrentLanguage = gDefaultLanguage;
|
gCurrentLanguage = gDefaultLanguage;
|
||||||
gCurrentCountry = gDefaultCountry;
|
gCurrentCountry = gDefaultCountry;
|
||||||
gCurrentProductArea = gDefaultProductArea;
|
gCurrentProductArea = gDefaultProductArea;
|
||||||
deinitLogging();
|
deinitLogging();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CAT_GENERAL_ROOT "root"
|
#define CAT_GENERAL_ROOT "root"
|
||||||
#define CAT_GENERAL_SETTINGS "general_settings"
|
#define CAT_GENERAL_SETTINGS "general_settings"
|
||||||
#define CAT_TITLE_SETTINGS "title_settings"
|
#define CAT_TITLE_SETTINGS "title_settings"
|
||||||
|
|
||||||
#define VAL_LANGUAGE "language"
|
#define VAL_LANGUAGE "language"
|
||||||
#define VAL_COUNTRY "cntry_reg"
|
#define VAL_COUNTRY "cntry_reg"
|
||||||
#define VAL_PRODUCT_AREA "product_area"
|
#define VAL_PRODUCT_AREA "product_area"
|
||||||
|
|
||||||
#define VAL_PREFER_SYSTEM_SETTINGS "prefer_system_settings"
|
#define VAL_PREFER_SYSTEM_SETTINGS "prefer_system_settings"
|
||||||
#define VAL_AUTO_DETECTION "auto_detection"
|
#define VAL_AUTO_DETECTION "auto_detection"
|
||||||
#define VAL_DEFAULT_LANG_EUR "default_lang_eur"
|
#define VAL_DEFAULT_LANG_EUR "default_lang_eur"
|
||||||
#define VAL_DEFAULT_LANG_USA "default_lang_usa"
|
#define VAL_DEFAULT_LANG_USA "default_lang_usa"
|
||||||
#define VAL_DEFAULT_LANG_JPN "default_lang_jpn"
|
#define VAL_DEFAULT_LANG_JPN "default_lang_jpn"
|
||||||
|
|
||||||
#define VAL_DEFAULT_COUNTRY_EUR "default_cntry_reg_eur"
|
#define VAL_DEFAULT_COUNTRY_EUR "default_cntry_reg_eur"
|
||||||
#define VAL_DEFAULT_COUNTRY_USA "default_cntry_reg_usa"
|
#define VAL_DEFAULT_COUNTRY_USA "default_cntry_reg_usa"
|
||||||
#define VAL_DEFAULT_COUNTRY_JPN "default_cntry_reg_jpn"
|
#define VAL_DEFAULT_COUNTRY_JPN "default_cntry_reg_jpn"
|
||||||
|
|
||||||
extern "C" void ACPInitialize();
|
extern "C" void ACPInitialize();
|
||||||
extern "C" void ACPFinalize();
|
extern "C" void ACPFinalize();
|
||||||
@ -101,24 +101,25 @@ DECL_FUNCTION(int32_t, ACPGetTitleMetaXmlByDevice, uint32_t titleid_upper, uint3
|
|||||||
ON_FUNCTIONS_PATCHED() {
|
ON_FUNCTIONS_PATCHED() {
|
||||||
MCPRegion real_product_area;
|
MCPRegion real_product_area;
|
||||||
auto real_product_area_valid = getRealProductArea(&real_product_area);
|
auto real_product_area_valid = getRealProductArea(&real_product_area);
|
||||||
if(real_product_area_valid){
|
if (real_product_area_valid) {
|
||||||
if(real_product_area == MCP_REGION_EUROPE){
|
if (real_product_area == MCP_REGION_EUROPE) {
|
||||||
gDefaultProductArea = MCP_REGION_EUROPE;
|
gDefaultProductArea = MCP_REGION_EUROPE;
|
||||||
gDefaultLanguage = gDefaultLangForEUR;
|
gDefaultLanguage = gDefaultLangForEUR;
|
||||||
gDefaultCountry = gDefaultCountryForEUR;
|
gDefaultCountry = gDefaultCountryForEUR;
|
||||||
} else if(real_product_area == MCP_REGION_JAPAN){
|
} else if (real_product_area == MCP_REGION_JAPAN) {
|
||||||
gDefaultProductArea = MCP_REGION_JAPAN;
|
gDefaultProductArea = MCP_REGION_JAPAN;
|
||||||
gDefaultLanguage = gDefaultLangForJPN;
|
gDefaultLanguage = gDefaultLangForJPN;
|
||||||
gDefaultCountry = gDefaultCountryForJPN;
|
gDefaultCountry = gDefaultCountryForJPN;
|
||||||
}if(real_product_area == MCP_REGION_USA){
|
}
|
||||||
|
if (real_product_area == MCP_REGION_USA) {
|
||||||
gDefaultProductArea = MCP_REGION_USA;
|
gDefaultProductArea = MCP_REGION_USA;
|
||||||
gDefaultLanguage = gDefaultLangForUSA;
|
gDefaultLanguage = gDefaultLangForUSA;
|
||||||
gDefaultCountry = gDefaultCountryForUSA;
|
gDefaultCountry = gDefaultCountryForUSA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool forceConfigMenu = false;
|
bool forceConfigMenu = false;
|
||||||
auto *acpMetaXml = (ACPMetaXml *) memalign(0x40, 0x4000);
|
auto *acpMetaXml = (ACPMetaXml *) memalign(0x40, 0x4000);
|
||||||
|
|
||||||
memset(acpMetaXml, 0, sizeof(ACPMetaXml));
|
memset(acpMetaXml, 0, sizeof(ACPMetaXml));
|
||||||
auto regionFromXML = 0;
|
auto regionFromXML = 0;
|
||||||
@ -133,18 +134,18 @@ ON_FUNCTIONS_PATCHED() {
|
|||||||
if (OSGetTitleID() == 0x0005001010040000L || acpMetaXml->region == 1) {
|
if (OSGetTitleID() == 0x0005001010040000L || acpMetaXml->region == 1) {
|
||||||
DEBUG_FUNCTION_LINE("Set default to JAPAN");
|
DEBUG_FUNCTION_LINE("Set default to JAPAN");
|
||||||
gDefaultProductArea = MCP_REGION_JAPAN;
|
gDefaultProductArea = MCP_REGION_JAPAN;
|
||||||
gDefaultLanguage = gDefaultLangForJPN;
|
gDefaultLanguage = gDefaultLangForJPN;
|
||||||
gDefaultCountry = gDefaultCountryForJPN;
|
gDefaultCountry = gDefaultCountryForJPN;
|
||||||
} else if (OSGetTitleID() == 0x0005001010040100L || acpMetaXml->region == 2) {
|
} else if (OSGetTitleID() == 0x0005001010040100L || acpMetaXml->region == 2) {
|
||||||
DEBUG_FUNCTION_LINE("Set default to USA");
|
DEBUG_FUNCTION_LINE("Set default to USA");
|
||||||
gDefaultProductArea = MCP_REGION_USA;
|
gDefaultProductArea = MCP_REGION_USA;
|
||||||
gDefaultLanguage = gDefaultLangForUSA;
|
gDefaultLanguage = gDefaultLangForUSA;
|
||||||
gDefaultCountry = gDefaultCountryForUSA;
|
gDefaultCountry = gDefaultCountryForUSA;
|
||||||
} else if (OSGetTitleID() == 0x0005001010040200L || acpMetaXml->region == 4) {
|
} else if (OSGetTitleID() == 0x0005001010040200L || acpMetaXml->region == 4) {
|
||||||
DEBUG_FUNCTION_LINE("Set default to EUR");
|
DEBUG_FUNCTION_LINE("Set default to EUR");
|
||||||
gDefaultProductArea = MCP_REGION_EUROPE;
|
gDefaultProductArea = MCP_REGION_EUROPE;
|
||||||
gDefaultLanguage = gDefaultLangForEUR;
|
gDefaultLanguage = gDefaultLangForEUR;
|
||||||
gDefaultCountry = gDefaultCountryForEUR;
|
gDefaultCountry = gDefaultCountryForEUR;
|
||||||
} else {
|
} else {
|
||||||
DEBUG_FUNCTION_LINE("Unknown area %08X, forcing language will be disabled", acpMetaXml->region);
|
DEBUG_FUNCTION_LINE("Unknown area %08X, forcing language will be disabled", acpMetaXml->region);
|
||||||
forceConfigMenu = true;
|
forceConfigMenu = true;
|
||||||
@ -160,8 +161,8 @@ ON_FUNCTIONS_PATCHED() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get region and lang from console and set these as default.
|
// Get region and lang from console and set these as default.
|
||||||
gCurrentLanguage = gDefaultLanguage;
|
gCurrentLanguage = gDefaultLanguage;
|
||||||
gCurrentCountry = gDefaultCountry;
|
gCurrentCountry = gDefaultCountry;
|
||||||
gCurrentProductArea = gDefaultProductArea;
|
gCurrentProductArea = gDefaultProductArea;
|
||||||
|
|
||||||
if (gPreferSystemSettings && real_product_area_valid) {
|
if (gPreferSystemSettings && real_product_area_valid) {
|
||||||
@ -172,10 +173,10 @@ ON_FUNCTIONS_PATCHED() {
|
|||||||
if (ucHandle >= 0) {
|
if (ucHandle >= 0) {
|
||||||
UCSysConfig sysConfig;
|
UCSysConfig sysConfig;
|
||||||
memset((void *) &sysConfig, 0, sizeof(sysConfig));
|
memset((void *) &sysConfig, 0, sizeof(sysConfig));
|
||||||
uint32_t data = 0xFFFFFFFF;
|
uint32_t data = 0xFFFFFFFF;
|
||||||
sysConfig.dataType = UC_DATATYPE_UNSIGNED_INT;
|
sysConfig.dataType = UC_DATATYPE_UNSIGNED_INT;
|
||||||
sysConfig.dataSize = 4;
|
sysConfig.dataSize = 4;
|
||||||
sysConfig.data = &data;
|
sysConfig.data = &data;
|
||||||
strncpy(sysConfig.name, "cafe.language", 64);
|
strncpy(sysConfig.name, "cafe.language", 64);
|
||||||
int ucRes = real_UCReadSysConfig(ucHandle, 1, &sysConfig);
|
int ucRes = real_UCReadSysConfig(ucHandle, 1, &sysConfig);
|
||||||
|
|
||||||
@ -194,7 +195,7 @@ ON_FUNCTIONS_PATCHED() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wups_storage_item_t *root = nullptr;
|
wups_storage_item_t *root = nullptr;
|
||||||
auto resa = WUPS_GetSubItem(nullptr, CAT_GENERAL_ROOT, &root);
|
auto resa = WUPS_GetSubItem(nullptr, CAT_GENERAL_ROOT, &root);
|
||||||
if (resa != WUPS_STORAGE_ERROR_SUCCESS) {
|
if (resa != WUPS_STORAGE_ERROR_SUCCESS) {
|
||||||
DEBUG_FUNCTION_LINE("Failed to read %s subitem", CAT_GENERAL_ROOT);
|
DEBUG_FUNCTION_LINE("Failed to read %s subitem", CAT_GENERAL_ROOT);
|
||||||
return;
|
return;
|
||||||
@ -372,11 +373,11 @@ 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) {
|
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;
|
uint32_t i = 0;
|
||||||
for (auto &curEntry: curLangMap) {
|
for (auto &curEntry : curLangMap) {
|
||||||
if (default_lang == curEntry.first) {
|
if (default_lang == curEntry.first) {
|
||||||
*default_index = i;
|
*default_index = i;
|
||||||
}
|
}
|
||||||
pair[i].value = curEntry.first;
|
pair[i].value = curEntry.first;
|
||||||
pair[i].valueName = (char *) curEntry.second;
|
pair[i].valueName = (char *) curEntry.second;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -397,26 +398,25 @@ WUPS_GET_CONFIG() {
|
|||||||
WUPSConfigItemBoolean_AddToCategoryHandled(config, cat, VAL_PREFER_SYSTEM_SETTINGS, "Prefer System Settings For Own Region", gPreferSystemSettings, &prefer_system_changed);
|
WUPSConfigItemBoolean_AddToCategoryHandled(config, cat, VAL_PREFER_SYSTEM_SETTINGS, "Prefer System Settings For Own Region", gPreferSystemSettings, &prefer_system_changed);
|
||||||
|
|
||||||
std::map<Lanuages, const char *> eur_lang_map{
|
std::map<Lanuages, const char *> eur_lang_map{
|
||||||
{LANG_ENGLISH, "English"},
|
{LANG_ENGLISH, "English"},
|
||||||
{LANG_FRANCAIS, "Francais"},
|
{LANG_FRANCAIS, "Francais"},
|
||||||
{LANG_DEUTSCH, "Deutsch"},
|
{LANG_DEUTSCH, "Deutsch"},
|
||||||
{LANG_ITALIANO, "Italiano"},
|
{LANG_ITALIANO, "Italiano"},
|
||||||
{LANG_ESPANOL, "Espanol"},
|
{LANG_ESPANOL, "Espanol"},
|
||||||
{LANG_NEDERLANDS, "Nederlands"},
|
{LANG_NEDERLANDS, "Nederlands"},
|
||||||
{LANG_PORTUGUES, "Portugues"},
|
{LANG_PORTUGUES, "Portugues"},
|
||||||
{LANG_RUSSKI, "Russki"},
|
{LANG_RUSSKI, "Russki"},
|
||||||
};
|
};
|
||||||
|
|
||||||
std::map<Lanuages, const char *> usa_lang_map{
|
std::map<Lanuages, const char *> usa_lang_map{
|
||||||
{LANG_ENGLISH, "English"},
|
{LANG_ENGLISH, "English"},
|
||||||
{LANG_FRANCAIS, "Francais"},
|
{LANG_FRANCAIS, "Francais"},
|
||||||
{LANG_ESPANOL, "Espanol"},
|
{LANG_ESPANOL, "Espanol"},
|
||||||
{LANG_PORTUGUES, "Portugues"}
|
{LANG_PORTUGUES, "Portugues"}};
|
||||||
};
|
|
||||||
|
|
||||||
ConfigItemMultipleValuesPair lang_eur_pair[eur_lang_map.size()];
|
ConfigItemMultipleValuesPair lang_eur_pair[eur_lang_map.size()];
|
||||||
uint32_t number_lang_eur_values = 0;
|
uint32_t number_lang_eur_values = 0;
|
||||||
uint32_t default_index_eur = 0;
|
uint32_t default_index_eur = 0;
|
||||||
|
|
||||||
getConfigInfoForLangMap(eur_lang_map, lang_eur_pair, gDefaultLangForEUR, &default_index_eur, &number_lang_eur_values);
|
getConfigInfoForLangMap(eur_lang_map, lang_eur_pair, gDefaultLangForEUR, &default_index_eur, &number_lang_eur_values);
|
||||||
|
|
||||||
@ -425,7 +425,7 @@ WUPS_GET_CONFIG() {
|
|||||||
|
|
||||||
ConfigItemMultipleValuesPair lang_usa_pair[eur_lang_map.size()];
|
ConfigItemMultipleValuesPair lang_usa_pair[eur_lang_map.size()];
|
||||||
uint32_t number_lang_usa_values = 0;
|
uint32_t number_lang_usa_values = 0;
|
||||||
uint32_t default_index_usa = 0;
|
uint32_t default_index_usa = 0;
|
||||||
|
|
||||||
getConfigInfoForLangMap(usa_lang_map, lang_usa_pair, gDefaultLangForUSA, &default_index_usa, &number_lang_usa_values);
|
getConfigInfoForLangMap(usa_lang_map, lang_usa_pair, gDefaultLangForUSA, &default_index_usa, &number_lang_usa_values);
|
||||||
|
|
||||||
@ -459,91 +459,91 @@ DECL_FUNCTION(int, MCP_GetSysProdSettings, int IOHandle, struct MCPSysProdSettin
|
|||||||
|
|
||||||
static const uint64_t
|
static const uint64_t
|
||||||
sSysAppTitleId[][3] =
|
sSysAppTitleId[][3] =
|
||||||
{
|
|
||||||
{
|
{
|
||||||
// Updater
|
{
|
||||||
0x0005001010040000ull,
|
// Updater
|
||||||
0x0005001010040100ull,
|
0x0005001010040000ull,
|
||||||
0x0005001010040200ull,
|
0x0005001010040100ull,
|
||||||
},
|
0x0005001010040200ull,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
// System Settings
|
// System Settings
|
||||||
0x0005001010047000ull,
|
0x0005001010047000ull,
|
||||||
0x0005001010047100ull,
|
0x0005001010047100ull,
|
||||||
0x0005001010047200ull,
|
0x0005001010047200ull,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
// Parental Controls
|
// Parental Controls
|
||||||
0x0005001010048000ull,
|
0x0005001010048000ull,
|
||||||
0x0005001010048100ull,
|
0x0005001010048100ull,
|
||||||
0x0005001010048200ull,
|
0x0005001010048200ull,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
// User Settings
|
// User Settings
|
||||||
0x0005001010049000ull,
|
0x0005001010049000ull,
|
||||||
0x0005001010049100ull,
|
0x0005001010049100ull,
|
||||||
0x0005001010049200ull,
|
0x0005001010049200ull,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
// Mii Maker
|
// Mii Maker
|
||||||
0x000500101004A000ull,
|
0x000500101004A000ull,
|
||||||
0x000500101004A100ull,
|
0x000500101004A100ull,
|
||||||
0x000500101004A200ull,
|
0x000500101004A200ull,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
// Account Settings
|
// Account Settings
|
||||||
0x000500101004B000ull,
|
0x000500101004B000ull,
|
||||||
0x000500101004B100ull,
|
0x000500101004B100ull,
|
||||||
0x000500101004B200ull,
|
0x000500101004B200ull,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
// Daily log
|
// Daily log
|
||||||
0x000500101004C000ull,
|
0x000500101004C000ull,
|
||||||
0x000500101004C100ull,
|
0x000500101004C100ull,
|
||||||
0x000500101004C200ull,
|
0x000500101004C200ull,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
// Notifications
|
// Notifications
|
||||||
0x000500101004D000ull,
|
0x000500101004D000ull,
|
||||||
0x000500101004D100ull,
|
0x000500101004D100ull,
|
||||||
0x000500101004D200ull,
|
0x000500101004D200ull,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
// Health and Safety Information
|
// Health and Safety Information
|
||||||
0x000500101004E000ull,
|
0x000500101004E000ull,
|
||||||
0x000500101004E100ull,
|
0x000500101004E100ull,
|
||||||
0x000500101004E200ull,
|
0x000500101004E200ull,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
// Electronic Manual
|
// Electronic Manual
|
||||||
0x0005001B10059000ull,
|
0x0005001B10059000ull,
|
||||||
0x0005001B10059100ull,
|
0x0005001B10059100ull,
|
||||||
0x0005001B10059200ull,
|
0x0005001B10059200ull,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
// Wii U Chat
|
// Wii U Chat
|
||||||
0x000500101005A000ull,
|
0x000500101005A000ull,
|
||||||
0x000500101005A100ull,
|
0x000500101005A100ull,
|
||||||
0x000500101005A200ull,
|
0x000500101005A200ull,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
// "Software/Data Transfer"
|
// "Software/Data Transfer"
|
||||||
0x0005001010062000ull,
|
0x0005001010062000ull,
|
||||||
0x0005001010062100ull,
|
0x0005001010062100ull,
|
||||||
0x0005001010062200ull,
|
0x0005001010062200ull,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
bool getRealProductArea(MCPRegion *out) {
|
bool getRealProductArea(MCPRegion *out) {
|
||||||
if (out == nullptr) {
|
if (out == nullptr) {
|
||||||
@ -552,7 +552,7 @@ bool getRealProductArea(MCPRegion *out) {
|
|||||||
auto handle = MCP_Open();
|
auto handle = MCP_Open();
|
||||||
if (handle >= 0) {
|
if (handle >= 0) {
|
||||||
auto data = (struct MCPSysProdSettings *) memalign(0x40, sizeof(struct MCPSysProdSettings));
|
auto data = (struct MCPSysProdSettings *) memalign(0x40, sizeof(struct MCPSysProdSettings));
|
||||||
auto res = real_MCP_GetSysProdSettings(handle, data);
|
auto res = real_MCP_GetSysProdSettings(handle, data);
|
||||||
if (res >= 0) {
|
if (res >= 0) {
|
||||||
*out = data->product_area;
|
*out = data->product_area;
|
||||||
}
|
}
|
||||||
@ -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(MCP_GetSysProdSettings, WUPS_LOADER_LIBRARY_COREINIT, MCP_GetSysProdSettings);
|
||||||
WUPS_MUST_REPLACE(UCReadSysConfig, WUPS_LOADER_LIBRARY_COREINIT, UCReadSysConfig);
|
WUPS_MUST_REPLACE(UCReadSysConfig, WUPS_LOADER_LIBRARY_COREINIT, UCReadSysConfig);
|
||||||
WUPS_MUST_REPLACE(_SYSGetSystemApplicationTitleIdByProdArea, WUPS_LOADER_LIBRARY_SYSAPP, _SYSGetSystemApplicationTitleIdByProdArea);
|
WUPS_MUST_REPLACE(_SYSGetSystemApplicationTitleIdByProdArea, WUPS_LOADER_LIBRARY_SYSAPP, _SYSGetSystemApplicationTitleIdByProdArea);
|
||||||
|
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <whb/log_udp.h>
|
|
||||||
#include <whb/log_cafe.h>
|
#include <whb/log_cafe.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;
|
||||||
uint32_t udpLogInit = false;
|
uint32_t udpLogInit = false;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
void initLogging() {
|
void initLogging() {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (!(moduleLogInit = WHBLogModuleInit())) {
|
if (!(moduleLogInit = WHBLogModuleInit())) {
|
||||||
cafeLogInit = WHBLogCafeInit();
|
cafeLogInit = WHBLogCafeInit();
|
||||||
udpLogInit = WHBLogUdpInit();
|
udpLogInit = WHBLogUdpInit();
|
||||||
}
|
}
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
}
|
}
|
||||||
|
@ -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" {
|
||||||
@ -9,26 +9,28 @@ extern "C" {
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
||||||
#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_VERBOSE(FMT, ARGS...) while (0)
|
#define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) while (0)
|
||||||
|
|
||||||
#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)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) while (0)
|
#define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) while (0)
|
||||||
|
|
||||||
#define DEBUG_FUNCTION_LINE(FMT, ARGS...) while (0)
|
#define DEBUG_FUNCTION_LINE(FMT, ARGS...) while (0)
|
||||||
|
|
||||||
#define DEBUG_FUNCTION_LINE_WRITE(FMT, ARGS...) while (0)
|
#define DEBUG_FUNCTION_LINE_WRITE(FMT, ARGS...) while (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -39,4 +41,3 @@ void deinitLogging();
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user