Format the code via clang-format
This commit is contained in:
parent
66e5d5b9f3
commit
00dec53199
|
@ -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
|
|
@ -6,8 +6,16 @@ on:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
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 ./relocator/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
|
||||||
|
|
|
@ -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 ./source ./relocator/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/WUMSLoader/actions/workflows/ci.yml/badge.svg)](https://github.com/wiiu-env/WUMSLoader/actions/workflows/ci.yml)
|
||||||
|
|
||||||
# Wii U Module System Loader
|
# Wii U Module System Loader
|
||||||
This is a payload that should be run with [EnvironmentLoader](https://github.com/wiiu-env/EnvironmentLoader).
|
This is a payload that should be run with [EnvironmentLoader](https://github.com/wiiu-env/EnvironmentLoader).
|
||||||
|
|
||||||
|
@ -29,6 +31,9 @@ docker run -it --rm -v ${PWD}:/project wumsloader-builder make
|
||||||
docker run -it --rm -v ${PWD}:/project wumsloader-builder make clean
|
docker run -it --rm -v ${PWD}:/project wumsloader-builder make clean
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Format the code via docker
|
||||||
|
|
||||||
|
`docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source ./relocator/src -i`
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
- maschell
|
- maschell
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <wums.h>
|
#include "../../source/module/RelocationData.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "../../source/module/RelocationData.h"
|
#include <wums.h>
|
||||||
|
|
||||||
class DynamicLinkingHelper {
|
class DynamicLinkingHelper {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <coreinit/cache.h>
|
#include <coreinit/cache.h>
|
||||||
|
|
||||||
#include "utils/logger.h"
|
|
||||||
#include "ElfUtils.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
|
// 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,
|
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,
|
||||||
|
|
|
@ -15,8 +15,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 "../../source/module/RelocationData.h"
|
|
||||||
#include "../../source/module/HookData.h"
|
#include "../../source/module/HookData.h"
|
||||||
|
#include "../../source/module/RelocationData.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -75,6 +76,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool relocationsDone = false;
|
bool relocationsDone = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::shared_ptr<RelocationData>> relocation_data_list;
|
std::vector<std::shared_ptr<RelocationData>> relocation_data_list;
|
||||||
std::vector<std::shared_ptr<HookData>> hook_data_list;
|
std::vector<std::shared_ptr<HookData>> hook_data_list;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <wums.h>
|
|
||||||
#include <vector>
|
|
||||||
#include "ModuleDataMinimal.h"
|
#include "ModuleDataMinimal.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <wums.h>
|
||||||
|
|
||||||
class ModuleDataPersistence {
|
class ModuleDataPersistence {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <coreinit/dynload.h>
|
|
||||||
#include <coreinit/cache.h>
|
|
||||||
#include <map>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <coreinit/memexpheap.h>
|
|
||||||
#include "utils/logger.h"
|
|
||||||
#include "utils/memory.h"
|
|
||||||
#include "../../source/module/RelocationData.h"
|
#include "../../source/module/RelocationData.h"
|
||||||
#include "ModuleDataPersistence.h"
|
|
||||||
#include "ElfUtils.h"
|
#include "ElfUtils.h"
|
||||||
#include "utils/dynamic.h"
|
#include "ModuleDataPersistence.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "hooks.h"
|
#include "hooks.h"
|
||||||
|
#include "utils/dynamic.h"
|
||||||
|
#include "utils/logger.h"
|
||||||
|
#include "utils/memory.h"
|
||||||
|
#include <algorithm>
|
||||||
|
#include <coreinit/cache.h>
|
||||||
|
#include <coreinit/dynload.h>
|
||||||
|
#include <coreinit/memexpheap.h>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
MEMHeapHandle gHeapHandle __attribute__((section(".data"))) = nullptr;
|
MEMHeapHandle gHeapHandle __attribute__((section(".data"))) = nullptr;
|
||||||
uint8_t gFunctionsPatched __attribute__((section(".data"))) = 0;
|
uint8_t gFunctionsPatched __attribute__((section(".data"))) = 0;
|
||||||
|
@ -132,7 +132,6 @@ bool ResolveRelocations(std::vector<std::shared_ptr<ModuleDataMinimal>> &loadedM
|
||||||
curModule->relocationsDone = false;
|
curModule->relocationsDone = false;
|
||||||
}
|
}
|
||||||
curModule->relocationsDone = true;
|
curModule->relocationsDone = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DCFlushRange((void *) MEMORY_REGION_START, MEMORY_REGION_SIZE);
|
DCFlushRange((void *) MEMORY_REGION_START, MEMORY_REGION_SIZE);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
#include "../../source/globals.h"
|
#include "../../source/globals.h"
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
extern uint32_t MemoryMappingEffectiveToPhysicalPTR;
|
extern uint32_t MemoryMappingEffectiveToPhysicalPTR;
|
||||||
extern uint32_t MemoryMappingPhysicalToEffectivePTR;
|
extern uint32_t MemoryMappingPhysicalToEffectivePTR;
|
|
@ -1,6 +1,6 @@
|
||||||
#include <wums.h>
|
|
||||||
#include "hooks.h"
|
#include "hooks.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
#include <wums.h>
|
||||||
|
|
||||||
static const char **hook_names = (const char *[]){
|
static const char **hook_names = (const char *[]){
|
||||||
"WUMS_HOOK_INIT_WUT_MALLOC",
|
"WUMS_HOOK_INIT_WUT_MALLOC",
|
||||||
|
@ -21,8 +21,7 @@ static const char **hook_names = (const char *[]) {
|
||||||
"WUMS_HOOK_APPLICATION_STARTS",
|
"WUMS_HOOK_APPLICATION_STARTS",
|
||||||
"WUMS_HOOK_APPLICATION_ENDS",
|
"WUMS_HOOK_APPLICATION_ENDS",
|
||||||
"WUMS_HOOK_RELOCATIONS_DONE",
|
"WUMS_HOOK_RELOCATIONS_DONE",
|
||||||
"WUMS_HOOK_APPLICATION_REQUESTS_EXIT"
|
"WUMS_HOOK_APPLICATION_REQUESTS_EXIT"};
|
||||||
};
|
|
||||||
|
|
||||||
void CallHook(const std::vector<std::shared_ptr<ModuleDataMinimal>> &modules, wums_hook_type_t type, bool condition) {
|
void CallHook(const std::vector<std::shared_ptr<ModuleDataMinimal>> &modules, wums_hook_type_t type, bool condition) {
|
||||||
if (condition) {
|
if (condition) {
|
||||||
|
@ -70,8 +69,7 @@ void CallHook(const std::shared_ptr<ModuleDataMinimal> &module, wums_hook_type_t
|
||||||
type == WUMS_HOOK_INIT_WUT_SOCKETS ||
|
type == WUMS_HOOK_INIT_WUT_SOCKETS ||
|
||||||
type == WUMS_HOOK_FINI_WUT_SOCKETS ||
|
type == WUMS_HOOK_FINI_WUT_SOCKETS ||
|
||||||
type == WUMS_HOOK_INIT_WRAPPER ||
|
type == WUMS_HOOK_INIT_WRAPPER ||
|
||||||
type == WUMS_HOOK_FINI_WRAPPER
|
type == WUMS_HOOK_FINI_WRAPPER)) {
|
||||||
)) {
|
|
||||||
DEBUG_FUNCTION_LINE_VERBOSE("Calling hook of type %s [%d] %d for %s: %08X\n", hook_names[type], type, curHook->getType(), module->getExportName().c_str(), curHook->getTarget());
|
DEBUG_FUNCTION_LINE_VERBOSE("Calling hook of type %s [%d] %d for %s: %08X\n", hook_names[type], type, curHook->getType(), module->getExportName().c_str(), curHook->getTarget());
|
||||||
((void (*)())((uint32_t *) func_ptr))();
|
((void (*)())((uint32_t *) func_ptr))();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <wums.h>
|
|
||||||
#include <vector>
|
|
||||||
#include "ModuleDataMinimal.h"
|
#include "ModuleDataMinimal.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <wums.h>
|
||||||
|
|
||||||
void CallHook(const std::vector<std::shared_ptr<ModuleDataMinimal>> &modules, wums_hook_type_t type, bool condition);
|
void CallHook(const std::vector<std::shared_ptr<ModuleDataMinimal>> &modules, wums_hook_type_t type, bool condition);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include <coreinit/dynload.h>
|
|
||||||
#include <coreinit/debug.h>
|
#include <coreinit/debug.h>
|
||||||
|
#include <coreinit/dynload.h>
|
||||||
|
|
||||||
#define IMPORT(name) void *addr_##name
|
#define IMPORT(name) void *addr_##name
|
||||||
#define IMPORT_BEGIN(lib)
|
#define IMPORT_BEGIN(lib)
|
||||||
|
@ -11,8 +11,14 @@
|
||||||
#undef IMPORT_BEGIN
|
#undef IMPORT_BEGIN
|
||||||
#undef IMPORT_END
|
#undef IMPORT_END
|
||||||
|
|
||||||
#define IMPORT(name) do{if(OSDynLoad_FindExport(handle, 0, #name, &addr_##name) < 0)OSFatal("Function " # name " is NULL");} while(0)
|
#define IMPORT(name) \
|
||||||
#define IMPORT_BEGIN(lib) do{if(OSDynLoad_IsModuleLoaded(#lib ".rpl", &handle) != OS_DYNLOAD_OK) OSFatal(#lib ".rpl is not loaded");} while(0)
|
do { \
|
||||||
|
if (OSDynLoad_FindExport(handle, 0, #name, &addr_##name) < 0) OSFatal("Function " #name " is NULL"); \
|
||||||
|
} while (0)
|
||||||
|
#define IMPORT_BEGIN(lib) \
|
||||||
|
do { \
|
||||||
|
if (OSDynLoad_IsModuleLoaded(#lib ".rpl", &handle) != OS_DYNLOAD_OK) OSFatal(#lib ".rpl is not loaded"); \
|
||||||
|
} while (0)
|
||||||
#define IMPORT_END()
|
#define IMPORT_END()
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,5 +29,4 @@ void InitFunctionPointers(void) {
|
||||||
addr_OSDynLoad_IsModuleLoaded = (void *) 0x0102A59C; // 0200e19c - 0xFE3C00
|
addr_OSDynLoad_IsModuleLoaded = (void *) 0x0102A59C; // 0200e19c - 0xFE3C00
|
||||||
|
|
||||||
#include "imports.h"
|
#include "imports.h"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include <coreinit/debug.h>
|
#include <coreinit/debug.h>
|
||||||
#include <coreinit/systeminfo.h>
|
#include <coreinit/systeminfo.h>
|
||||||
#include <coreinit/thread.h>
|
#include <coreinit/thread.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
static int log_socket __attribute__((section(".data"))) = -1;
|
static int log_socket __attribute__((section(".data"))) = -1;
|
||||||
static struct sockaddr_in connect_addr __attribute__((section(".data")));
|
static struct sockaddr_in connect_addr __attribute__((section(".data")));
|
||||||
|
@ -139,4 +139,3 @@ void log_printf(const char *format, ...) {
|
||||||
}
|
}
|
||||||
va_end(va);
|
va_end(va);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,15 +20,18 @@ void OSFatal_printf(const char *format, ...);
|
||||||
#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 OSFATAL_FUNCTION_LINE(FMT, ARGS...)do { \
|
#define OSFATAL_FUNCTION_LINE(FMT, ARGS...) \
|
||||||
|
do { \
|
||||||
OSFatal_printf("[%s]%s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
|
OSFatal_printf("[%s]%s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define DEBUG_FUNCTION_LINE(FMT, ARGS...)do { \
|
#define DEBUG_FUNCTION_LINE(FMT, ARGS...) \
|
||||||
|
do { \
|
||||||
log_printf("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
|
log_printf("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...)do { \
|
#define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) \
|
||||||
|
do { \
|
||||||
log_printf("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
|
log_printf("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
|
@ -14,14 +14,14 @@
|
||||||
* 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/memexpheap.h>
|
#include "logger.h"
|
||||||
#include <coreinit/memdefaultheap.h>
|
|
||||||
#include <coreinit/memorymap.h>
|
|
||||||
#include <coreinit/cache.h>
|
#include <coreinit/cache.h>
|
||||||
|
#include <coreinit/memdefaultheap.h>
|
||||||
|
#include <coreinit/memexpheap.h>
|
||||||
|
#include <coreinit/memorymap.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
|
||||||
#include "logger.h"
|
|
||||||
|
|
||||||
extern MEMHeapHandle gHeapHandle;
|
extern MEMHeapHandle gHeapHandle;
|
||||||
|
|
||||||
|
@ -113,12 +113,10 @@ struct mallinfo _mallinfo_r(struct _reent *r) {
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void _malloc_stats_r(struct _reent *r) {
|
||||||
_malloc_stats_r(struct _reent *r) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int _mallopt_r(struct _reent *r, int param, int value) {
|
||||||
_mallopt_r(struct _reent *r, int param, int value) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +135,6 @@ _pvalloc_r(struct _reent *r, size_t size) {
|
||||||
return MemoryAllocEx((size + (OS_PAGE_SIZE - 1)) & ~(OS_PAGE_SIZE - 1), OS_PAGE_SIZE);
|
return MemoryAllocEx((size + (OS_PAGE_SIZE - 1)) & ~(OS_PAGE_SIZE - 1), OS_PAGE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int _malloc_trim_r(struct _reent *r, size_t pad) {
|
||||||
_malloc_trim_r(struct _reent *r, size_t pad) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#include <coreinit/debug.h>
|
#include "utils/logger.h"
|
||||||
#include <coreinit/cache.h>
|
#include <coreinit/cache.h>
|
||||||
|
#include <coreinit/debug.h>
|
||||||
#include <coreinit/memdefaultheap.h>
|
#include <coreinit/memdefaultheap.h>
|
||||||
#include <whb/sdcard.h>
|
|
||||||
#include <whb/file.h>
|
#include <whb/file.h>
|
||||||
#include <whb/log.h>
|
#include <whb/log.h>
|
||||||
#include "utils/logger.h"
|
#include <whb/sdcard.h>
|
||||||
|
|
||||||
#include "elfio/elfio.hpp"
|
|
||||||
#include "ElfUtils.h"
|
#include "ElfUtils.h"
|
||||||
|
#include "elfio/elfio.hpp"
|
||||||
|
|
||||||
int32_t LoadFileToMem(const char *relativefilepath, char **fileOut, uint32_t *sizeOut) {
|
int32_t LoadFileToMem(const char *relativefilepath, char **fileOut, uint32_t *sizeOut) {
|
||||||
char path[256];
|
char path[256];
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// clang-format off
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// clang-format off
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// clang-format off
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// clang-format off
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// clang-format off
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// clang-format off
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// clang-format off
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// clang-format off
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// clang-format off
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// clang-format off
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// clang-format off
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// clang-format off
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
Copyright (C) 2001-2015 by Serge Lamikhov-Center
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <strings.h>
|
|
||||||
#include <fs/CFile.hpp>
|
#include <fs/CFile.hpp>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <strings.h>
|
||||||
|
|
||||||
CFile::CFile() {
|
CFile::CFile() {
|
||||||
iFd = -1;
|
iFd = -1;
|
||||||
|
@ -171,5 +171,3 @@ int32_t CFile::fwrite(const char *format, ...) {
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -24,14 +24,14 @@
|
||||||
* DirList Class
|
* DirList Class
|
||||||
* for WiiXplorer 2010
|
* for WiiXplorer 2010
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
#include <algorithm>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <algorithm>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/dirent.h>
|
#include <sys/dirent.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <fs/DirList.h>
|
#include <fs/DirList.h>
|
||||||
#include <utils/StringTools.h>
|
#include <utils/StringTools.h>
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
#ifndef ___DIRLIST_H_
|
#ifndef ___DIRLIST_H_
|
||||||
#define ___DIRLIST_H_
|
#define ___DIRLIST_H_
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
#include <wut_types.h>
|
#include <wut_types.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -97,6 +97,7 @@ public:
|
||||||
Dirs = 0x02,
|
Dirs = 0x02,
|
||||||
CheckSubfolders = 0x08,
|
CheckSubfolders = 0x08,
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Internal parser
|
// Internal parser
|
||||||
BOOL InternalLoadPath(std::string &path);
|
BOOL InternalLoadPath(std::string &path);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "relocator_elf.h"
|
|
||||||
#include "ElfUtils.h"
|
#include "ElfUtils.h"
|
||||||
|
#include "relocator_elf.h"
|
||||||
#include <coreinit/cache.h>
|
#include <coreinit/cache.h>
|
||||||
#include <coreinit/memorymap.h>
|
#include <coreinit/memorymap.h>
|
||||||
|
|
||||||
|
@ -54,6 +54,5 @@ void __attribute__ ((noinline)) kern_write(void *addr, uint32_t value) {
|
||||||
:
|
:
|
||||||
: "r"(addr), "r"(value)
|
: "r"(addr), "r"(value)
|
||||||
: "memory", "ctr", "lr", "0", "3", "4", "5", "6", "7", "8", "9", "10",
|
: "memory", "ctr", "lr", "0", "3", "4", "5", "6", "7", "8", "9", "10",
|
||||||
"11", "12"
|
"11", "12");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include <elfio/elfio.hpp>
|
#include <elfio/elfio.hpp>
|
||||||
#include <sysapp/launch.h>
|
|
||||||
#include <nn/act/client_cpp.h>
|
#include <nn/act/client_cpp.h>
|
||||||
|
#include <sysapp/launch.h>
|
||||||
|
|
||||||
#include "fs/DirList.h"
|
|
||||||
#include "module/ModuleDataPersistence.h"
|
|
||||||
#include "module/ModuleDataFactory.h"
|
|
||||||
#include "ElfUtils.h"
|
#include "ElfUtils.h"
|
||||||
#include "kernel.h"
|
#include "fs/DirList.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
#include "kernel.h"
|
||||||
|
#include "module/ModuleDataFactory.h"
|
||||||
|
#include "module/ModuleDataPersistence.h"
|
||||||
|
|
||||||
extern "C" uint32_t textStart();
|
extern "C" uint32_t textStart();
|
||||||
extern "C" void __fini();
|
extern "C" void __fini();
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#include "DynamicLinkingHelper.h"
|
#include "DynamicLinkingHelper.h"
|
||||||
|
#include "utils/logger.h"
|
||||||
|
#include <coreinit/dynload.h>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <coreinit/dynload.h>
|
|
||||||
#include "utils/logger.h"
|
|
||||||
|
|
||||||
dyn_linking_function_t *DynamicLinkingHelper::getOrAddFunctionEntryByName(dyn_linking_relocation_data_t *data, const char *functionName) {
|
dyn_linking_function_t *DynamicLinkingHelper::getOrAddFunctionEntryByName(dyn_linking_relocation_data_t *data, const char *functionName) {
|
||||||
if (data == nullptr) {
|
if (data == nullptr) {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <wums.h>
|
#include "RelocationData.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "RelocationData.h"
|
#include <wums.h>
|
||||||
|
|
||||||
class DynamicLinkingHelper {
|
class DynamicLinkingHelper {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include <wums.h>
|
#include <wums.h>
|
||||||
|
|
||||||
class ExportData {
|
class ExportData {
|
||||||
|
|
|
@ -24,8 +24,7 @@ class FunctionSymbolData {
|
||||||
public:
|
public:
|
||||||
FunctionSymbolData(const FunctionSymbolData &o2) = default;
|
FunctionSymbolData(const FunctionSymbolData &o2) = default;
|
||||||
|
|
||||||
FunctionSymbolData(const char *name, void *address, uint32_t size) :
|
FunctionSymbolData(const char *name, void *address, uint32_t size) : name(name),
|
||||||
name(name),
|
|
||||||
address(address),
|
address(address),
|
||||||
size(size) {
|
size(size) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,11 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <optional>
|
|
||||||
#include <utility>
|
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
class ImportRPLInformation {
|
class ImportRPLInformation {
|
||||||
|
|
||||||
|
|
|
@ -17,15 +17,15 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include "ExportData.h"
|
||||||
#include <vector>
|
#include "FunctionSymbolData.h"
|
||||||
#include <map>
|
#include "HookData.h"
|
||||||
#include <set>
|
|
||||||
#include "RelocationData.h"
|
#include "RelocationData.h"
|
||||||
#include "SectionInfo.h"
|
#include "SectionInfo.h"
|
||||||
#include "ExportData.h"
|
#include <map>
|
||||||
#include "HookData.h"
|
#include <set>
|
||||||
#include "FunctionSymbolData.h"
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
struct FunctionSymbolDataComparator {
|
struct FunctionSymbolDataComparator {
|
||||||
bool operator()(const std::shared_ptr<FunctionSymbolData> &lhs,
|
bool operator()(const std::shared_ptr<FunctionSymbolData> &lhs,
|
||||||
|
@ -164,6 +164,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool relocationsDone = false;
|
bool relocationsDone = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::shared_ptr<RelocationData>> relocation_data_list;
|
std::vector<std::shared_ptr<RelocationData>> relocation_data_list;
|
||||||
std::vector<std::shared_ptr<ExportData>> export_data_list;
|
std::vector<std::shared_ptr<ExportData>> export_data_list;
|
||||||
|
|
|
@ -15,15 +15,15 @@
|
||||||
* 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 <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
|
||||||
#include <coreinit/cache.h>
|
|
||||||
#include <wums.h>
|
|
||||||
#include "ModuleDataFactory.h"
|
#include "ModuleDataFactory.h"
|
||||||
#include "utils/utils.h"
|
|
||||||
#include "ElfUtils.h"
|
#include "ElfUtils.h"
|
||||||
#include "FunctionSymbolData.h"
|
#include "FunctionSymbolData.h"
|
||||||
|
#include "utils/utils.h"
|
||||||
|
#include <coreinit/cache.h>
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <wums.h>
|
||||||
|
|
||||||
using namespace ELFIO;
|
using namespace ELFIO;
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,12 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
|
||||||
#include <wums.h>
|
|
||||||
#include "ModuleData.h"
|
#include "ModuleData.h"
|
||||||
#include "elfio/elfio.hpp"
|
#include "elfio/elfio.hpp"
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <wums.h>
|
||||||
|
|
||||||
class ModuleDataFactory {
|
class ModuleDataFactory {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include <coreinit/cache.h>
|
|
||||||
#include "ModuleDataPersistence.h"
|
#include "ModuleDataPersistence.h"
|
||||||
#include "DynamicLinkingHelper.h"
|
#include "DynamicLinkingHelper.h"
|
||||||
|
#include <coreinit/cache.h>
|
||||||
|
|
||||||
bool ModuleDataPersistence::saveModuleData(module_information_t *moduleInformation, const std::shared_ptr<ModuleData> &module) {
|
bool ModuleDataPersistence::saveModuleData(module_information_t *moduleInformation, const std::shared_ptr<ModuleData> &module) {
|
||||||
int32_t module_count = moduleInformation->number_used_modules;
|
int32_t module_count = moduleInformation->number_used_modules;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <wums.h>
|
|
||||||
#include "ModuleData.h"
|
#include "ModuleData.h"
|
||||||
|
#include <wums.h>
|
||||||
|
|
||||||
class ModuleDataPersistence {
|
class ModuleDataPersistence {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <memory>
|
|
||||||
#include <utility>
|
|
||||||
#include "ImportRPLInformation.h"
|
#include "ImportRPLInformation.h"
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
class RelocationData {
|
class RelocationData {
|
||||||
|
|
||||||
|
|
|
@ -23,16 +23,14 @@
|
||||||
class SectionInfo {
|
class SectionInfo {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SectionInfo(std::string name, uint32_t address, uint32_t sectionSize) :
|
SectionInfo(std::string name, uint32_t address, uint32_t sectionSize) : name(std::move(name)),
|
||||||
name(std::move(name)),
|
|
||||||
address(address),
|
address(address),
|
||||||
sectionSize(sectionSize) {
|
sectionSize(sectionSize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SectionInfo() = default;
|
SectionInfo() = default;
|
||||||
|
|
||||||
SectionInfo(const SectionInfo &o2) :
|
SectionInfo(const SectionInfo &o2) : name(o2.name),
|
||||||
name(o2.name),
|
|
||||||
address(o2.address),
|
address(o2.address),
|
||||||
sectionSize(o2.sectionSize) {
|
sectionSize(o2.sectionSize) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,17 +23,16 @@
|
||||||
*
|
*
|
||||||
* for WiiXplorer 2010
|
* for WiiXplorer 2010
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <string.h>
|
||||||
#include <wchar.h>
|
#include <string>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <wut_types.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <utils/StringTools.h>
|
#include <utils/StringTools.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) {
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
#ifndef __STRING_TOOLS_H
|
#ifndef __STRING_TOOLS_H
|
||||||
#define __STRING_TOOLS_H
|
#define __STRING_TOOLS_H
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
#include <wut_types.h>
|
#include <wut_types.h>
|
||||||
|
|
||||||
class StringTools {
|
class StringTools {
|
||||||
|
@ -62,4 +62,3 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __STRING_TOOLS_H */
|
#endif /* __STRING_TOOLS_H */
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#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;
|
||||||
|
|
|
@ -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" {
|
||||||
|
@ -14,11 +14,13 @@ extern "C" {
|
||||||
|
|
||||||
#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...) \
|
||||||
|
do { \
|
||||||
WHBLogPrintf("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
|
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...) \
|
||||||
|
do { \
|
||||||
WHBLogWritef("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
|
WHBLogWritef("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -39,4 +41,3 @@ void deinitLogging();
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <string.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <whb/log.h>
|
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <whb/log.h>
|
||||||
|
|
||||||
// https://gist.github.com/ccbrown/9722406
|
// https://gist.github.com/ccbrown/9722406
|
||||||
void dumpHex(const void *data, size_t size) {
|
void dumpHex(const void *data, size_t size) {
|
||||||
|
|
|
@ -12,7 +12,8 @@ extern "C" {
|
||||||
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)
|
||||||
|
|
Loading…
Reference in New Issue