mirror of
https://github.com/wiiu-env/homebrew_on_menu_plugin.git
synced 2024-11-21 18:19:15 +01:00
Format the code via clang-format
This commit is contained in:
parent
bcd07eb726
commit
d2c53b77af
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:
|
|||||||
- 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 ./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/homebrew_on_menu_plugin/actions/workflows/ci.yml/badge.svg)](https://github.com/wiiu-env/homebrew_on_menu_plugin/actions/workflows/ci.yml)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
(`[ENVIRONMENT]` is a placeholder for the actual environment name.)
|
(`[ENVIRONMENT]` is a placeholder for the actual environment name.)
|
||||||
|
|
||||||
@ -19,3 +21,7 @@ docker run -it --rm -v ${PWD}:/project homebrew_on_menu_plugin-builder make
|
|||||||
# make clean
|
# make clean
|
||||||
docker run -it --rm -v ${PWD}:/project homebrew_on_menu_plugin-builder make clean
|
docker run -it --rm -v ${PWD}:/project homebrew_on_menu_plugin-builder make clean
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Format the code via docker
|
||||||
|
|
||||||
|
`docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./include ./libraries ./plugins/example_plugin/src -i`
|
@ -1,11 +1,11 @@
|
|||||||
#include "FileWrapper.h"
|
#include "FileWrapper.h"
|
||||||
#include <cstdlib>
|
|
||||||
#include "fileinfos.h"
|
#include "fileinfos.h"
|
||||||
#include <cstring>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <rpxloader.h>
|
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
#include <coreinit/cache.h>
|
#include <coreinit/cache.h>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
#include <rpxloader.h>
|
||||||
|
|
||||||
FileHandleWrapper gFileHandleWrapper[FILE_WRAPPER_SIZE] __attribute__((section(".data")));
|
FileHandleWrapper gFileHandleWrapper[FILE_WRAPPER_SIZE] __attribute__((section(".data")));
|
||||||
|
|
||||||
@ -28,8 +28,8 @@ int OpenFileForID(int id, const char *filepath, int *handle) {
|
|||||||
snprintf(romName, 10, "%08X", id);
|
snprintf(romName, 10, "%08X", id);
|
||||||
|
|
||||||
char *dyn_path = (char *) malloc(strlen(filepath) + 1);
|
char *dyn_path = (char *) malloc(strlen(filepath) + 1);
|
||||||
char last = 0;
|
char last = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (int i = 0; filepath[i] != 0; i++) {
|
for (int i = 0; filepath[i] != 0; i++) {
|
||||||
if (filepath[i] == '/') {
|
if (filepath[i] == '/') {
|
||||||
if (filepath[i] != last) {
|
if (filepath[i] != last) {
|
||||||
@ -56,7 +56,7 @@ int OpenFileForID(int id, const char *filepath, int *handle) {
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
gFileHandleWrapper[handle_wrapper_slot].handle = out_handle;
|
gFileHandleWrapper[handle_wrapper_slot].handle = out_handle;
|
||||||
*handle = 0xFF000000 | (id << 12) | (handle_wrapper_slot & 0x00000FFF);
|
*handle = 0xFF000000 | (id << 12) | (handle_wrapper_slot & 0x00000FFF);
|
||||||
gFileInfos[id].openedFiles++;
|
gFileInfos[id].openedFiles++;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
typedef struct FileHandleWrapper_t {
|
typedef struct FileHandleWrapper_t {
|
||||||
uint32_t handle;
|
uint32_t handle;
|
||||||
bool inUse;
|
bool inUse;
|
||||||
} FileHandleWrapper;
|
} FileHandleWrapper;
|
||||||
|
|
||||||
#define FILE_WRAPPER_SIZE 64
|
#define FILE_WRAPPER_SIZE 64
|
||||||
extern FileHandleWrapper gFileHandleWrapper[FILE_WRAPPER_SIZE];
|
extern FileHandleWrapper gFileHandleWrapper[FILE_WRAPPER_SIZE];
|
||||||
|
|
||||||
int OpenFileForID(int id, const char * path, int32_t * handle);
|
int OpenFileForID(int id, const char *path, int32_t *handle);
|
@ -1,8 +1,8 @@
|
|||||||
#include <cstring>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <rpxloader.h>
|
|
||||||
#include "utils/logger.h"
|
|
||||||
#include "fileinfos.h"
|
#include "fileinfos.h"
|
||||||
|
#include "utils/logger.h"
|
||||||
|
#include <cstring>
|
||||||
|
#include <rpxloader.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
FileInfos gFileInfos[FILE_INFO_SIZE] __attribute__((section(".data")));
|
FileInfos gFileInfos[FILE_INFO_SIZE] __attribute__((section(".data")));
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ bool mountRomfs(uint32_t id) {
|
|||||||
char romName[10];
|
char romName[10];
|
||||||
snprintf(romName, 10, "%08X", id);
|
snprintf(romName, 10, "%08X", id);
|
||||||
DEBUG_FUNCTION_LINE("Mount %s as %s", buffer, romName);
|
DEBUG_FUNCTION_LINE("Mount %s as %s", buffer, romName);
|
||||||
int32_t res = 0;
|
int32_t res = 0;
|
||||||
if ((res = RL_MountBundle(romName, buffer, BundleSource_FileDescriptor_CafeOS)) == 0) {
|
if ((res = RL_MountBundle(romName, buffer, BundleSource_FileDescriptor_CafeOS)) == 0) {
|
||||||
DEBUG_FUNCTION_LINE("Mounted successfully ");
|
DEBUG_FUNCTION_LINE("Mounted successfully ");
|
||||||
gFileInfos[id].romfsMounted = true;
|
gFileInfos[id].romfsMounted = true;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
#include <coreinit/mcp.h>
|
#include <coreinit/mcp.h>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
typedef struct WUT_PACKED FileInfos_ {
|
typedef struct WUT_PACKED FileInfos_ {
|
||||||
char path[256];
|
char path[256];
|
||||||
@ -16,7 +16,7 @@ typedef struct WUT_PACKED FileInfos_ {
|
|||||||
MCPTitleListType titleInfo;
|
MCPTitleListType titleInfo;
|
||||||
} FileInfos;
|
} FileInfos;
|
||||||
|
|
||||||
#define FILE_INFO_SIZE 300
|
#define FILE_INFO_SIZE 300
|
||||||
extern FileInfos gFileInfos[FILE_INFO_SIZE];
|
extern FileInfos gFileInfos[FILE_INFO_SIZE];
|
||||||
|
|
||||||
int32_t getIDByLowerTitleID(uint32_t lowerTitleID);
|
int32_t getIDByLowerTitleID(uint32_t lowerTitleID);
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
|
|
||||||
#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;
|
||||||
mem_file = nullptr;
|
mem_file = nullptr;
|
||||||
filesize = 0;
|
filesize = 0;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFile::CFile(const std::string &filepath, eOpenTypes mode) {
|
CFile::CFile(const std::string &filepath, eOpenTypes mode) {
|
||||||
@ -35,7 +35,7 @@ int32_t CFile::open(const std::string &filepath, eOpenTypes mode) {
|
|||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
default:
|
default:
|
||||||
case ReadOnly: // file must exist
|
case ReadOnly: // file must exist
|
||||||
openMode = O_RDONLY;
|
openMode = O_RDONLY;
|
||||||
break;
|
break;
|
||||||
case WriteOnly: // file will be created / zerod
|
case WriteOnly: // file will be created / zerod
|
||||||
@ -77,10 +77,10 @@ void CFile::close() {
|
|||||||
if (iFd >= 0)
|
if (iFd >= 0)
|
||||||
::close(iFd);
|
::close(iFd);
|
||||||
|
|
||||||
iFd = -1;
|
iFd = -1;
|
||||||
mem_file = NULL;
|
mem_file = NULL;
|
||||||
filesize = 0;
|
filesize = 0;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CFile::read(uint8_t *ptr, size_t size) {
|
int32_t CFile::read(uint8_t *ptr, size_t size) {
|
||||||
@ -127,7 +127,7 @@ int32_t CFile::write(const uint8_t *ptr, size_t size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t CFile::seek(long int offset, int32_t origin) {
|
int32_t CFile::seek(long int offset, int32_t origin) {
|
||||||
int32_t ret = 0;
|
int32_t ret = 0;
|
||||||
int64_t newPos = pos;
|
int64_t newPos = pos;
|
||||||
|
|
||||||
if (origin == SEEK_SET) {
|
if (origin == SEEK_SET) {
|
||||||
@ -158,7 +158,7 @@ int32_t CFile::seek(long int offset, int32_t origin) {
|
|||||||
|
|
||||||
int32_t CFile::fwrite(const char *format, ...) {
|
int32_t CFile::fwrite(const char *format, ...) {
|
||||||
char tmp[512];
|
char tmp[512];
|
||||||
tmp[0] = 0;
|
tmp[0] = 0;
|
||||||
int32_t result = -1;
|
int32_t result = -1;
|
||||||
|
|
||||||
va_list va;
|
va_list va;
|
||||||
@ -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,22 +24,22 @@
|
|||||||
* 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>
|
||||||
|
|
||||||
DirList::DirList() {
|
DirList::DirList() {
|
||||||
Flags = 0;
|
Flags = 0;
|
||||||
Filter = 0;
|
Filter = 0;
|
||||||
Depth = 0;
|
Depth = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DirList::DirList(const std::string &path, const char *filter, uint32_t flags, uint32_t maxDepth) {
|
DirList::DirList(const std::string &path, const char *filter, uint32_t flags, uint32_t maxDepth) {
|
||||||
@ -55,9 +55,9 @@ BOOL DirList::LoadPath(const std::string &folder, const char *filter, uint32_t f
|
|||||||
if (folder.empty())
|
if (folder.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Flags = flags;
|
Flags = flags;
|
||||||
Filter = filter;
|
Filter = filter;
|
||||||
Depth = maxDepth;
|
Depth = maxDepth;
|
||||||
|
|
||||||
std::string folderpath(folder);
|
std::string folderpath(folder);
|
||||||
uint32_t length = folderpath.size();
|
uint32_t length = folderpath.size();
|
||||||
@ -82,14 +82,14 @@ BOOL DirList::InternalLoadPath(std::string &folderpath) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
struct dirent *dirent = NULL;
|
struct dirent *dirent = NULL;
|
||||||
DIR *dir = NULL;
|
DIR *dir = NULL;
|
||||||
|
|
||||||
dir = opendir(folderpath.c_str());
|
dir = opendir(folderpath.c_str());
|
||||||
if (dir == NULL)
|
if (dir == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
while ((dirent = readdir(dir)) != 0) {
|
while ((dirent = readdir(dir)) != 0) {
|
||||||
BOOL isDir = dirent->d_type & DT_DIR;
|
BOOL isDir = dirent->d_type & DT_DIR;
|
||||||
const char *filename = dirent->d_name;
|
const char *filename = dirent->d_name;
|
||||||
|
|
||||||
if (isDir) {
|
if (isDir) {
|
||||||
|
@ -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 {
|
||||||
@ -93,10 +93,11 @@ public:
|
|||||||
|
|
||||||
//! Enum for search/filter flags
|
//! Enum for search/filter flags
|
||||||
enum {
|
enum {
|
||||||
Files = 0x01,
|
Files = 0x01,
|
||||||
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,11 +1,11 @@
|
|||||||
#include <malloc.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include "fs/FSUtils.h"
|
#include "fs/FSUtils.h"
|
||||||
#include "fs/CFile.hpp"
|
#include "fs/CFile.hpp"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
int32_t FSUtils::LoadFileToMem(const char *filepath, uint8_t **inbuffer, uint32_t *size) {
|
int32_t FSUtils::LoadFileToMem(const char *filepath, uint8_t **inbuffer, uint32_t *size) {
|
||||||
//! always initialze input
|
//! always initialze input
|
||||||
@ -27,8 +27,8 @@ int32_t FSUtils::LoadFileToMem(const char *filepath, uint8_t **inbuffer, uint32_
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t blocksize = 0x100000;
|
uint32_t blocksize = 0x100000;
|
||||||
uint32_t done = 0;
|
uint32_t done = 0;
|
||||||
int32_t readBytes = 0;
|
int32_t readBytes = 0;
|
||||||
|
|
||||||
while (done < filesize) {
|
while (done < filesize) {
|
||||||
if (done + blocksize > filesize) {
|
if (done + blocksize > filesize) {
|
||||||
@ -62,7 +62,7 @@ int32_t FSUtils::CheckFile(const char *filepath) {
|
|||||||
if (!filepath)
|
if (!filepath)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
struct stat filestat{};
|
struct stat filestat {};
|
||||||
|
|
||||||
char dirnoslash[strlen(filepath) + 2];
|
char dirnoslash[strlen(filepath) + 2];
|
||||||
snprintf(dirnoslash, sizeof(dirnoslash), "%s", filepath);
|
snprintf(dirnoslash, sizeof(dirnoslash), "%s", filepath);
|
||||||
@ -139,4 +139,3 @@ int32_t FSUtils::saveBufferToFile(const char *path, void *buffer, uint32_t size)
|
|||||||
file.close();
|
file.close();
|
||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
119
src/main.cpp
119
src/main.cpp
@ -1,22 +1,22 @@
|
|||||||
#include <wups.h>
|
|
||||||
#include <cstring>
|
|
||||||
#include <coreinit/debug.h>
|
|
||||||
#include <coreinit/title.h>
|
|
||||||
#include <coreinit/cache.h>
|
|
||||||
#include <coreinit/systeminfo.h>
|
|
||||||
#include <coreinit/mcp.h>
|
|
||||||
#include <coreinit/filesystem.h>
|
|
||||||
#include <sysapp/title.h>
|
|
||||||
#include <nn/acp.h>
|
|
||||||
#include <utils/logger.h>
|
|
||||||
#include "utils/StringTools.h"
|
|
||||||
#include <fs/DirList.h>
|
|
||||||
#include "fileinfos.h"
|
|
||||||
#include <rpxloader.h>
|
|
||||||
#include "fs/FSUtils.h"
|
|
||||||
#include "filelist.h"
|
|
||||||
#include "utils/ini.h"
|
|
||||||
#include "FileWrapper.h"
|
#include "FileWrapper.h"
|
||||||
|
#include "fileinfos.h"
|
||||||
|
#include "filelist.h"
|
||||||
|
#include "fs/FSUtils.h"
|
||||||
|
#include "utils/StringTools.h"
|
||||||
|
#include "utils/ini.h"
|
||||||
|
#include <coreinit/cache.h>
|
||||||
|
#include <coreinit/debug.h>
|
||||||
|
#include <coreinit/filesystem.h>
|
||||||
|
#include <coreinit/mcp.h>
|
||||||
|
#include <coreinit/systeminfo.h>
|
||||||
|
#include <coreinit/title.h>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fs/DirList.h>
|
||||||
|
#include <nn/acp.h>
|
||||||
|
#include <rpxloader.h>
|
||||||
|
#include <sysapp/title.h>
|
||||||
|
#include <utils/logger.h>
|
||||||
|
#include <wups.h>
|
||||||
|
|
||||||
typedef struct ACPMetaData {
|
typedef struct ACPMetaData {
|
||||||
char bootmovie[80696];
|
char bootmovie[80696];
|
||||||
@ -31,14 +31,14 @@ WUPS_PLUGIN_LICENSE("GPL");
|
|||||||
|
|
||||||
#define UPPER_TITLE_ID_HOMEBREW 0x0005000F
|
#define UPPER_TITLE_ID_HOMEBREW 0x0005000F
|
||||||
|
|
||||||
#define TITLE_ID_HOMEBREW_MASK (((uint64_t) UPPER_TITLE_ID_HOMEBREW) << 32)
|
#define TITLE_ID_HOMEBREW_MASK (((uint64_t) UPPER_TITLE_ID_HOMEBREW) << 32)
|
||||||
|
|
||||||
ACPMetaXml gLaunchXML __attribute__((section(".data")));
|
ACPMetaXml gLaunchXML __attribute__((section(".data")));
|
||||||
MCPTitleListType current_launched_title_info __attribute__((section(".data")));
|
MCPTitleListType current_launched_title_info __attribute__((section(".data")));
|
||||||
BOOL gHomebrewLaunched __attribute__((section(".data")));
|
BOOL gHomebrewLaunched __attribute__((section(".data")));
|
||||||
bool doReboot = false;
|
bool doReboot = false;
|
||||||
|
|
||||||
bool lastResult = false;
|
bool lastResult = false;
|
||||||
uint32_t sd_check_cooldown = 0;
|
uint32_t sd_check_cooldown = 0;
|
||||||
|
|
||||||
extern FSClient *__wut_devoptab_fs_client;
|
extern FSClient *__wut_devoptab_fs_client;
|
||||||
@ -89,21 +89,21 @@ void fillXmlForTitleID(uint32_t titleid_upper, uint32_t titleid_lower, ACPMetaXm
|
|||||||
strncpy(out_buf->longname_en, gFileInfos[id].longname, 64);
|
strncpy(out_buf->longname_en, gFileInfos[id].longname, 64);
|
||||||
strncpy(out_buf->shortname_en, gFileInfos[id].shortname, 64);
|
strncpy(out_buf->shortname_en, gFileInfos[id].shortname, 64);
|
||||||
strncpy(out_buf->publisher_en, gFileInfos[id].author, 64);
|
strncpy(out_buf->publisher_en, gFileInfos[id].author, 64);
|
||||||
out_buf->e_manual = 1;
|
out_buf->e_manual = 1;
|
||||||
out_buf->e_manual_version = 0;
|
out_buf->e_manual_version = 0;
|
||||||
out_buf->title_version = 1;
|
out_buf->title_version = 1;
|
||||||
out_buf->network_use = 1;
|
out_buf->network_use = 1;
|
||||||
out_buf->launching_flag = 4;
|
out_buf->launching_flag = 4;
|
||||||
out_buf->online_account_use = 1;
|
out_buf->online_account_use = 1;
|
||||||
out_buf->os_version = 0x000500101000400A;
|
out_buf->os_version = 0x000500101000400A;
|
||||||
out_buf->region = 0xFFFFFFFF;
|
out_buf->region = 0xFFFFFFFF;
|
||||||
out_buf->common_save_size = 0x0000000001790000;
|
out_buf->common_save_size = 0x0000000001790000;
|
||||||
out_buf->group_id = 0x400;
|
out_buf->group_id = 0x400;
|
||||||
out_buf->drc_use = 1;
|
out_buf->drc_use = 1;
|
||||||
out_buf->version = 1;
|
out_buf->version = 1;
|
||||||
out_buf->reserved_flag0 = 0x00010001;
|
out_buf->reserved_flag0 = 0x00010001;
|
||||||
out_buf->reserved_flag6 = 0x00000003;
|
out_buf->reserved_flag6 = 0x00000003;
|
||||||
out_buf->pc_usk = 128;
|
out_buf->pc_usk = 128;
|
||||||
strncpy(out_buf->product_code, "WUP-P-HBLD", strlen("WUP-P-HBLD") + 1);
|
strncpy(out_buf->product_code, "WUP-P-HBLD", strlen("WUP-P-HBLD") + 1);
|
||||||
strncpy(out_buf->content_platform, "WUP", strlen("WUP") + 1);
|
strncpy(out_buf->content_platform, "WUP", strlen("WUP") + 1);
|
||||||
strncpy(out_buf->company_code, "0001", strlen("0001") + 1);
|
strncpy(out_buf->company_code, "0001", strlen("0001") + 1);
|
||||||
@ -134,7 +134,7 @@ static int handler(void *user, const char *section, const char *name,
|
|||||||
} else if (MATCH("menu", "author")) {
|
} else if (MATCH("menu", "author")) {
|
||||||
strncpy(fInfo->author, value, 64 - 1);
|
strncpy(fInfo->author, value, 64 - 1);
|
||||||
} else {
|
} else {
|
||||||
return 0; /* unknown section/name, error */
|
return 0; /* unknown section/name, error */
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -175,8 +175,8 @@ void readCustomTitlesFromSD() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *repl = (char *) "fs:/vol/external01/";
|
char *repl = (char *) "fs:/vol/external01/";
|
||||||
char *with = (char *) "";
|
char *with = (char *) "";
|
||||||
char *input = (char *) dirList.GetFilepath(i);
|
char *input = (char *) dirList.GetFilepath(i);
|
||||||
|
|
||||||
char *path = StringTools::str_replace(input, repl, with);
|
char *path = StringTools::str_replace(input, repl, with);
|
||||||
@ -250,20 +250,20 @@ void readCustomTitlesFromSD() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_title_info->titleId = TITLE_ID_HOMEBREW_MASK | gFileInfos[j].lowerTitleID;
|
cur_title_info->titleId = TITLE_ID_HOMEBREW_MASK | gFileInfos[j].lowerTitleID;
|
||||||
cur_title_info->titleVersion = 1;
|
cur_title_info->titleVersion = 1;
|
||||||
cur_title_info->groupId = 0x400;
|
cur_title_info->groupId = 0x400;
|
||||||
|
|
||||||
cur_title_info->osVersion = OSGetOSID();
|
cur_title_info->osVersion = OSGetOSID();
|
||||||
cur_title_info->sdkVersion = __OSGetProcessSDKVersion();
|
cur_title_info->sdkVersion = __OSGetProcessSDKVersion();
|
||||||
cur_title_info->unk0x60 = 0;
|
cur_title_info->unk0x60 = 0;
|
||||||
|
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DECL_FUNCTION(int32_t, MCP_TitleList, uint32_t handle, uint32_t *outTitleCount, MCPTitleListType *titleList, uint32_t size) {
|
DECL_FUNCTION(int32_t, MCP_TitleList, uint32_t handle, uint32_t *outTitleCount, MCPTitleListType *titleList, uint32_t size) {
|
||||||
int32_t result = real_MCP_TitleList(handle, outTitleCount, titleList, size);
|
int32_t result = real_MCP_TitleList(handle, outTitleCount, titleList, size);
|
||||||
uint32_t titlecount = *outTitleCount;
|
uint32_t titlecount = *outTitleCount;
|
||||||
|
|
||||||
for (auto &gFileInfo : gFileInfos) {
|
for (auto &gFileInfo : gFileInfos) {
|
||||||
@ -300,14 +300,13 @@ DECL_FUNCTION(int32_t, ACPCheckTitleLaunchByTitleListTypeEx, MCPTitleListType *t
|
|||||||
|
|
||||||
int result = real_ACPCheckTitleLaunchByTitleListTypeEx(title, u2);
|
int result = real_ACPCheckTitleLaunchByTitleListTypeEx(title, u2);
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DECL_FUNCTION(int, FSOpenFile, FSClient *client, FSCmdBlock *block, char *path, const char *mode, int *handle, int error) {
|
DECL_FUNCTION(int, FSOpenFile, FSClient *client, FSCmdBlock *block, char *path, const char *mode, int *handle, int error) {
|
||||||
const char *start = "/vol/storage_mlc01/sys/title/0005000F";
|
const char *start = "/vol/storage_mlc01/sys/title/0005000F";
|
||||||
const char *icon = ".tga";
|
const char *icon = ".tga";
|
||||||
const char *iconTex = "iconTex.tga";
|
const char *iconTex = "iconTex.tga";
|
||||||
const char *sound = ".btsnd";
|
const char *sound = ".btsnd";
|
||||||
|
|
||||||
if (StringTools::EndsWith(path, icon) || StringTools::EndsWith(path, sound)) {
|
if (StringTools::EndsWith(path, icon) || StringTools::EndsWith(path, sound)) {
|
||||||
if (strncmp(path, start, strlen(start)) == 0) {
|
if (strncmp(path, start, strlen(start)) == 0) {
|
||||||
@ -316,12 +315,12 @@ DECL_FUNCTION(int, FSOpenFile, FSClient *client, FSCmdBlock *block, char *path,
|
|||||||
if (StringTools::EndsWith(path, iconTex)) {
|
if (StringTools::EndsWith(path, iconTex)) {
|
||||||
// fallback to dummy icon if loaded homebrew is no .wbf
|
// fallback to dummy icon if loaded homebrew is no .wbf
|
||||||
*handle = 0x13371338;
|
*handle = 0x13371338;
|
||||||
res = FS_STATUS_OK;
|
res = FS_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t lowerTitleID;
|
uint32_t lowerTitleID;
|
||||||
char *id = path + 1 + strlen(start);
|
char *id = path + 1 + strlen(start);
|
||||||
id[8] = 0;
|
id[8] = 0;
|
||||||
char *ending = id + 9;
|
char *ending = id + 9;
|
||||||
sscanf(id, "%08X", &lowerTitleID);
|
sscanf(id, "%08X", &lowerTitleID);
|
||||||
int32_t idVal = getIDByLowerTitleID(lowerTitleID);
|
int32_t idVal = getIDByLowerTitleID(lowerTitleID);
|
||||||
@ -344,8 +343,8 @@ DECL_FUNCTION(FSStatus, FSCloseFile, FSClient *client, FSCmdBlock *block, FSFile
|
|||||||
if (handle == 0x13371338) {
|
if (handle == 0x13371338) {
|
||||||
return FS_STATUS_OK;
|
return FS_STATUS_OK;
|
||||||
} else if ((handle & 0xFF000000) == 0xFF000000) {
|
} else if ((handle & 0xFF000000) == 0xFF000000) {
|
||||||
int32_t fd = (handle & 0x00000FFF);
|
int32_t fd = (handle & 0x00000FFF);
|
||||||
int32_t romid = (handle & 0x00FFF000) >> 12;
|
int32_t romid = (handle & 0x00FFF000) >> 12;
|
||||||
uint32_t rl_handle = gFileHandleWrapper[fd].handle;
|
uint32_t rl_handle = gFileHandleWrapper[fd].handle;
|
||||||
RL_FileClose(rl_handle);
|
RL_FileClose(rl_handle);
|
||||||
if (gFileInfos[romid].openedFiles--) {
|
if (gFileInfos[romid].openedFiles--) {
|
||||||
@ -369,7 +368,7 @@ DECL_FUNCTION(FSStatus, FSReadFile, FSClient *client, FSCmdBlock *block, uint8_t
|
|||||||
memcpy(buffer, iconTex_tga, cpySize);
|
memcpy(buffer, iconTex_tga, cpySize);
|
||||||
return (FSStatus) (cpySize / size);
|
return (FSStatus) (cpySize / size);
|
||||||
} else if ((handle & 0xFF000000) == 0xFF000000) {
|
} else if ((handle & 0xFF000000) == 0xFF000000) {
|
||||||
int32_t fd = (handle & 0x00000FFF);
|
int32_t fd = (handle & 0x00000FFF);
|
||||||
int32_t romid = (handle & 0x00FFF000) >> 12;
|
int32_t romid = (handle & 0x00FFF000) >> 12;
|
||||||
|
|
||||||
uint32_t rl_handle = gFileHandleWrapper[fd].handle;
|
uint32_t rl_handle = gFileHandleWrapper[fd].handle;
|
||||||
@ -426,8 +425,8 @@ DECL_FUNCTION(int32_t, ACPGetLaunchMetaXml, ACPMetaXml *metaxml) {
|
|||||||
DECL_FUNCTION(uint32_t, ACPGetApplicationBox, uint32_t *u1, uint32_t *u2, uint32_t u3, uint32_t u4) {
|
DECL_FUNCTION(uint32_t, ACPGetApplicationBox, uint32_t *u1, uint32_t *u2, uint32_t u3, uint32_t u4) {
|
||||||
if (u3 == UPPER_TITLE_ID_HOMEBREW) {
|
if (u3 == UPPER_TITLE_ID_HOMEBREW) {
|
||||||
uint64_t titleID = _SYSGetSystemApplicationTitleId(SYSTEM_APP_ID_HEALTH_AND_SAFETY);
|
uint64_t titleID = _SYSGetSystemApplicationTitleId(SYSTEM_APP_ID_HEALTH_AND_SAFETY);
|
||||||
u3 = (uint32_t) (titleID >> 32);
|
u3 = (uint32_t) (titleID >> 32);
|
||||||
u4 = (uint32_t) (0x00000000FFFFFFFF & titleID);
|
u4 = (uint32_t) (0x00000000FFFFFFFF & titleID);
|
||||||
}
|
}
|
||||||
uint32_t result = real_ACPGetApplicationBox(u1, u2, u3, u4);
|
uint32_t result = real_ACPGetApplicationBox(u1, u2, u3, u4);
|
||||||
return result;
|
return result;
|
||||||
@ -439,8 +438,8 @@ DECL_FUNCTION(uint32_t, ACPGetApplicationBox, uint32_t *u1, uint32_t *u2, uint32
|
|||||||
DECL_FUNCTION(uint32_t, PatchChkStart__3RplFRCQ3_2nn6drmapp8StartArg, uint32_t *param) {
|
DECL_FUNCTION(uint32_t, PatchChkStart__3RplFRCQ3_2nn6drmapp8StartArg, uint32_t *param) {
|
||||||
if (param[2] == UPPER_TITLE_ID_HOMEBREW) {
|
if (param[2] == UPPER_TITLE_ID_HOMEBREW) {
|
||||||
uint64_t titleID = _SYSGetSystemApplicationTitleId(SYSTEM_APP_ID_HEALTH_AND_SAFETY);
|
uint64_t titleID = _SYSGetSystemApplicationTitleId(SYSTEM_APP_ID_HEALTH_AND_SAFETY);
|
||||||
param[2] = (uint32_t) (titleID >> 32);
|
param[2] = (uint32_t) (titleID >> 32);
|
||||||
param[3] = (uint32_t) (0x00000000FFFFFFFF & titleID);
|
param[3] = (uint32_t) (0x00000000FFFFFFFF & titleID);
|
||||||
}
|
}
|
||||||
uint32_t result = real_PatchChkStart__3RplFRCQ3_2nn6drmapp8StartArg(param);
|
uint32_t result = real_PatchChkStart__3RplFRCQ3_2nn6drmapp8StartArg(param);
|
||||||
return result;
|
return result;
|
||||||
@ -452,8 +451,8 @@ DECL_FUNCTION(uint32_t, PatchChkStart__3RplFRCQ3_2nn6drmapp8StartArg, uint32_t *
|
|||||||
DECL_FUNCTION(uint32_t, MCP_RightCheckLaunchable, uint32_t *u1, uint32_t *u2, uint32_t u3, uint32_t u4, uint32_t u5) {
|
DECL_FUNCTION(uint32_t, MCP_RightCheckLaunchable, uint32_t *u1, uint32_t *u2, uint32_t u3, uint32_t u4, uint32_t u5) {
|
||||||
if (u3 == UPPER_TITLE_ID_HOMEBREW) {
|
if (u3 == UPPER_TITLE_ID_HOMEBREW) {
|
||||||
uint64_t titleID = _SYSGetSystemApplicationTitleId(SYSTEM_APP_ID_HEALTH_AND_SAFETY);
|
uint64_t titleID = _SYSGetSystemApplicationTitleId(SYSTEM_APP_ID_HEALTH_AND_SAFETY);
|
||||||
u3 = (uint32_t) (titleID >> 32);
|
u3 = (uint32_t) (titleID >> 32);
|
||||||
u4 = (uint32_t) (0x00000000FFFFFFFF & titleID);
|
u4 = (uint32_t) (0x00000000FFFFFFFF & titleID);
|
||||||
}
|
}
|
||||||
uint32_t result = real_MCP_RightCheckLaunchable(u1, u2, u3, u4, u5);
|
uint32_t result = real_MCP_RightCheckLaunchable(u1, u2, u3, u4, u5);
|
||||||
return result;
|
return result;
|
||||||
@ -500,8 +499,8 @@ DECL_FUNCTION(uint32_t, GetTitleVersionInfo__Q2_2nn4vctlFPQ3_2nn4vctl16TitleVers
|
|||||||
if (expected_u3 == u3 && expected_u4 == u4) {
|
if (expected_u3 == u3 && expected_u4 == u4) {
|
||||||
if (titleVersionInfo != nullptr) {
|
if (titleVersionInfo != nullptr) {
|
||||||
titleVersionInfo->currentVersion = 129;
|
titleVersionInfo->currentVersion = 129;
|
||||||
titleVersionInfo->neededVersion = 129;
|
titleVersionInfo->neededVersion = 129;
|
||||||
titleVersionInfo->needsUpdate = 0;
|
titleVersionInfo->needsUpdate = 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
@ -85,7 +84,7 @@ const wchar_t *StringTools::wfmt(const char *format, ...) {
|
|||||||
static char tmp[512];
|
static char tmp[512];
|
||||||
static wchar_t strWChar[512];
|
static wchar_t strWChar[512];
|
||||||
strWChar[0] = 0;
|
strWChar[0] = 0;
|
||||||
tmp[0] = 0;
|
tmp[0] = 0;
|
||||||
|
|
||||||
if (!format)
|
if (!format)
|
||||||
return (const wchar_t *) strWChar;
|
return (const wchar_t *) strWChar;
|
||||||
@ -98,7 +97,7 @@ const wchar_t *StringTools::wfmt(const char *format, ...) {
|
|||||||
if ((vsprintf(tmp, format, va) >= 0)) {
|
if ((vsprintf(tmp, format, va) >= 0)) {
|
||||||
int bt;
|
int bt;
|
||||||
int32_t strlength = strlen(tmp);
|
int32_t strlength = strlen(tmp);
|
||||||
bt = mbstowcs(strWChar, tmp, (strlength < 512) ? strlength : 512);
|
bt = mbstowcs(strWChar, tmp, (strlength < 512) ? strlength : 512);
|
||||||
|
|
||||||
if (bt > 0) {
|
if (bt > 0) {
|
||||||
strWChar[bt] = 0;
|
strWChar[bt] = 0;
|
||||||
@ -112,13 +111,13 @@ const wchar_t *StringTools::wfmt(const char *format, ...) {
|
|||||||
|
|
||||||
int32_t StringTools::strprintf(std::string &str, const char *format, ...) {
|
int32_t StringTools::strprintf(std::string &str, const char *format, ...) {
|
||||||
static char tmp[512];
|
static char tmp[512];
|
||||||
tmp[0] = 0;
|
tmp[0] = 0;
|
||||||
int32_t result = 0;
|
int32_t result = 0;
|
||||||
|
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
if ((vsprintf(tmp, format, va) >= 0)) {
|
if ((vsprintf(tmp, format, va) >= 0)) {
|
||||||
str = tmp;
|
str = tmp;
|
||||||
result = str.size();
|
result = str.size();
|
||||||
}
|
}
|
||||||
va_end(va);
|
va_end(va);
|
||||||
@ -215,7 +214,7 @@ const char *StringTools::FullpathToFilename(const char *path) {
|
|||||||
if (!path)
|
if (!path)
|
||||||
return path;
|
return path;
|
||||||
|
|
||||||
const char *ptr = path;
|
const char *ptr = path;
|
||||||
const char *Filename = ptr;
|
const char *Filename = ptr;
|
||||||
|
|
||||||
while (*ptr != '\0') {
|
while (*ptr != '\0') {
|
||||||
@ -244,13 +243,13 @@ void StringTools::RemoveDoubleSlashs(std::string &str) {
|
|||||||
|
|
||||||
// You must free the result if result is non-NULL.
|
// You must free the result if result is non-NULL.
|
||||||
char *StringTools::str_replace(char *orig, char *rep, char *with) {
|
char *StringTools::str_replace(char *orig, char *rep, char *with) {
|
||||||
char *result; // the return string
|
char *result; // the return string
|
||||||
char *ins; // the next insert point
|
char *ins; // the next insert point
|
||||||
char *tmp; // varies
|
char *tmp; // varies
|
||||||
int len_rep; // length of rep (the string to remove)
|
int len_rep; // length of rep (the string to remove)
|
||||||
int len_with; // length of with (the string to replace rep with)
|
int len_with; // length of with (the string to replace rep with)
|
||||||
int len_front; // distance between rep and end of last rep
|
int len_front; // distance between rep and end of last rep
|
||||||
int count; // number of replacements
|
int count; // number of replacements
|
||||||
|
|
||||||
// sanity checks and initialization
|
// sanity checks and initialization
|
||||||
if (!orig || !rep)
|
if (!orig || !rep)
|
||||||
@ -279,10 +278,10 @@ char *StringTools::str_replace(char *orig, char *rep, char *with) {
|
|||||||
// ins points to the next occurrence of rep in orig
|
// ins points to the next occurrence of rep in orig
|
||||||
// orig points to the remainder of orig after "end of rep"
|
// orig points to the remainder of orig after "end of rep"
|
||||||
while (count--) {
|
while (count--) {
|
||||||
ins = strstr(orig, rep);
|
ins = strstr(orig, rep);
|
||||||
len_front = ins - orig;
|
len_front = ins - orig;
|
||||||
tmp = strncpy(tmp, orig, len_front) + len_front;
|
tmp = strncpy(tmp, orig, len_front) + len_front;
|
||||||
tmp = strcpy(tmp, with) + len_with;
|
tmp = strcpy(tmp, with) + len_with;
|
||||||
orig += len_front + len_rep; // move to next "end of rep"
|
orig += len_front + len_rep; // move to next "end of rep"
|
||||||
}
|
}
|
||||||
strcpy(tmp, orig);
|
strcpy(tmp, orig);
|
||||||
|
@ -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,12 +1,16 @@
|
|||||||
/* inih -- simple .INI file parser
|
/* inih -- simple .INI file parser
|
||||||
|
|
||||||
|
SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
Copyright (C) 2009-2020, Ben Hoyt
|
||||||
|
|
||||||
inih is released under the New BSD license (see LICENSE.txt). Go to the project
|
inih is released under the New BSD license (see LICENSE.txt). Go to the project
|
||||||
home page for more info:
|
home page for more info:
|
||||||
|
|
||||||
https://github.com/benhoyt/inih
|
https://github.com/benhoyt/inih
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
// clang-format off
|
||||||
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
|
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
@ -18,7 +22,17 @@ https://github.com/benhoyt/inih
|
|||||||
#include "ini.h"
|
#include "ini.h"
|
||||||
|
|
||||||
#if !INI_USE_STACK
|
#if !INI_USE_STACK
|
||||||
|
#if INI_CUSTOM_ALLOCATOR
|
||||||
|
#include <stddef.h>
|
||||||
|
void* ini_malloc(size_t size);
|
||||||
|
void ini_free(void* ptr);
|
||||||
|
void* ini_realloc(void* ptr, size_t size);
|
||||||
|
#else
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#define ini_malloc malloc
|
||||||
|
#define ini_free free
|
||||||
|
#define ini_realloc realloc
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_SECTION 50
|
#define MAX_SECTION 50
|
||||||
@ -48,7 +62,7 @@ static char* lskip(const char* s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Return pointer to first char (of chars) or inline comment in given string,
|
/* Return pointer to first char (of chars) or inline comment in given string,
|
||||||
or pointer to null at end of string if neither found. Inline comment must
|
or pointer to NUL at end of string if neither found. Inline comment must
|
||||||
be prefixed by a whitespace character to register as a comment. */
|
be prefixed by a whitespace character to register as a comment. */
|
||||||
static char* find_chars_or_comment(const char* s, const char* chars)
|
static char* find_chars_or_comment(const char* s, const char* chars)
|
||||||
{
|
{
|
||||||
@ -67,14 +81,15 @@ static char* find_chars_or_comment(const char* s, const char* chars)
|
|||||||
return (char*)s;
|
return (char*)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
|
/* Similar to strncpy, but ensures dest (size bytes) is
|
||||||
|
NUL-terminated, and doesn't pad with NULs. */
|
||||||
static char* strncpy0(char* dest, const char* src, size_t size)
|
static char* strncpy0(char* dest, const char* src, size_t size)
|
||||||
{
|
{
|
||||||
#pragma GCC diagnostic push
|
/* Could use strncpy internally, but it causes gcc warnings (see issue #91) */
|
||||||
#pragma GCC diagnostic ignored "-Wstringop-truncation"
|
size_t i;
|
||||||
strncpy(dest, src, size - 1);
|
for (i = 0; i < size - 1 && src[i]; i++)
|
||||||
#pragma GCC diagnostic pop
|
dest[i] = src[i];
|
||||||
dest[size - 1] = '\0';
|
dest[i] = '\0';
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,11 +103,11 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
|||||||
int max_line = INI_MAX_LINE;
|
int max_line = INI_MAX_LINE;
|
||||||
#else
|
#else
|
||||||
char* line;
|
char* line;
|
||||||
int max_line = INI_INITIAL_ALLOC;
|
size_t max_line = INI_INITIAL_ALLOC;
|
||||||
#endif
|
#endif
|
||||||
#if INI_ALLOW_REALLOC
|
#if INI_ALLOW_REALLOC && !INI_USE_STACK
|
||||||
char* new_line;
|
char* new_line;
|
||||||
int offset;
|
size_t offset;
|
||||||
#endif
|
#endif
|
||||||
char section[MAX_SECTION] = "";
|
char section[MAX_SECTION] = "";
|
||||||
char prev_name[MAX_NAME] = "";
|
char prev_name[MAX_NAME] = "";
|
||||||
@ -105,7 +120,7 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
|||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
#if !INI_USE_STACK
|
#if !INI_USE_STACK
|
||||||
line = (char*)malloc(INI_INITIAL_ALLOC);
|
line = (char*)ini_malloc(INI_INITIAL_ALLOC);
|
||||||
if (!line) {
|
if (!line) {
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@ -118,20 +133,20 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Scan through stream line by line */
|
/* Scan through stream line by line */
|
||||||
while (reader(line, max_line, stream) != NULL) {
|
while (reader(line, (int)max_line, stream) != NULL) {
|
||||||
#if INI_ALLOW_REALLOC
|
#if INI_ALLOW_REALLOC && !INI_USE_STACK
|
||||||
offset = strlen(line);
|
offset = strlen(line);
|
||||||
while (offset == max_line - 1 && line[offset - 1] != '\n') {
|
while (offset == max_line - 1 && line[offset - 1] != '\n') {
|
||||||
max_line *= 2;
|
max_line *= 2;
|
||||||
if (max_line > INI_MAX_LINE)
|
if (max_line > INI_MAX_LINE)
|
||||||
max_line = INI_MAX_LINE;
|
max_line = INI_MAX_LINE;
|
||||||
new_line = realloc(line, max_line);
|
new_line = ini_realloc(line, max_line);
|
||||||
if (!new_line) {
|
if (!new_line) {
|
||||||
free(line);
|
ini_free(line);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
line = new_line;
|
line = new_line;
|
||||||
if (reader(line + offset, max_line - offset, stream) == NULL)
|
if (reader(line + offset, (int)(max_line - offset), stream) == NULL)
|
||||||
break;
|
break;
|
||||||
if (max_line >= INI_MAX_LINE)
|
if (max_line >= INI_MAX_LINE)
|
||||||
break;
|
break;
|
||||||
@ -169,6 +184,10 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
|||||||
*end = '\0';
|
*end = '\0';
|
||||||
strncpy0(section, start + 1, sizeof(section));
|
strncpy0(section, start + 1, sizeof(section));
|
||||||
*prev_name = '\0';
|
*prev_name = '\0';
|
||||||
|
#if INI_CALL_HANDLER_ON_NEW_SECTION
|
||||||
|
if (!HANDLER(user, section, NULL, NULL) && !error)
|
||||||
|
error = lineno;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (!error) {
|
else if (!error) {
|
||||||
/* No ']' found on section line */
|
/* No ']' found on section line */
|
||||||
@ -197,7 +216,14 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
|||||||
}
|
}
|
||||||
else if (!error) {
|
else if (!error) {
|
||||||
/* No '=' or ':' found on name[=:]value line */
|
/* No '=' or ':' found on name[=:]value line */
|
||||||
|
#if INI_ALLOW_NO_VALUE
|
||||||
|
*end = '\0';
|
||||||
|
name = rstrip(start);
|
||||||
|
if (!HANDLER(user, section, name, NULL) && !error)
|
||||||
|
error = lineno;
|
||||||
|
#else
|
||||||
error = lineno;
|
error = lineno;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +234,7 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !INI_USE_STACK
|
#if !INI_USE_STACK
|
||||||
free(line);
|
ini_free(line);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
/* inih -- simple .INI file parser
|
/* inih -- simple .INI file parser
|
||||||
|
|
||||||
|
SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
Copyright (C) 2009-2020, Ben Hoyt
|
||||||
|
|
||||||
inih is released under the New BSD license (see LICENSE.txt). Go to the project
|
inih is released under the New BSD license (see LICENSE.txt). Go to the project
|
||||||
home page for more info:
|
home page for more info:
|
||||||
|
|
||||||
https://github.com/benhoyt/inih
|
https://github.com/benhoyt/inih
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
// clang-format off
|
||||||
#ifndef __INI_H__
|
#ifndef INI_H
|
||||||
#define __INI_H__
|
#define INI_H
|
||||||
|
|
||||||
/* Make this header file easier to include in C++ code */
|
/* Make this header file easier to include in C++ code */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -73,7 +77,7 @@ int ini_parse_string(const char* string, ini_handler handler, void* user);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Nonzero to allow a UTF-8 BOM sequence (0xEF 0xBB 0xBF) at the start of
|
/* Nonzero to allow a UTF-8 BOM sequence (0xEF 0xBB 0xBF) at the start of
|
||||||
the file. See http://code.google.com/p/inih/issues/detail?id=21 */
|
the file. See https://github.com/benhoyt/inih/issues/21 */
|
||||||
#ifndef INI_ALLOW_BOM
|
#ifndef INI_ALLOW_BOM
|
||||||
#define INI_ALLOW_BOM 1
|
#define INI_ALLOW_BOM 1
|
||||||
#endif
|
#endif
|
||||||
@ -123,8 +127,31 @@ int ini_parse_string(const char* string, ini_handler handler, void* user);
|
|||||||
#define INI_STOP_ON_FIRST_ERROR 0
|
#define INI_STOP_ON_FIRST_ERROR 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Nonzero to call the handler at the start of each new section (with
|
||||||
|
name and value NULL). Default is to only call the handler on
|
||||||
|
each name=value pair. */
|
||||||
|
#ifndef INI_CALL_HANDLER_ON_NEW_SECTION
|
||||||
|
#define INI_CALL_HANDLER_ON_NEW_SECTION 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Nonzero to allow a name without a value (no '=' or ':' on the line) and
|
||||||
|
call the handler with value NULL in this case. Default is to treat
|
||||||
|
no-value lines as an error. */
|
||||||
|
#ifndef INI_ALLOW_NO_VALUE
|
||||||
|
#define INI_ALLOW_NO_VALUE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Nonzero to use custom ini_malloc, ini_free, and ini_realloc memory
|
||||||
|
allocation functions (INI_USE_STACK must also be 0). These functions must
|
||||||
|
have the same signatures as malloc/free/realloc and behave in a similar
|
||||||
|
way. ini_realloc is only needed if INI_ALLOW_REALLOC is set. */
|
||||||
|
#ifndef INI_CUSTOM_ALLOCATOR
|
||||||
|
#define INI_CUSTOM_ALLOCATOR 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __INI_H__ */
|
#endif /* INI_H */
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <whb/log.h>
|
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdlib.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) {
|
||||||
|
@ -7,23 +7,24 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LIMIT(x, min, max) \
|
#define LIMIT(x, min, max) \
|
||||||
({ \
|
({ \
|
||||||
typeof( x ) _x = x; \
|
typeof(x) _x = x; \
|
||||||
typeof( min ) _min = min; \
|
typeof(min) _min = min; \
|
||||||
typeof( max ) _max = max; \
|
typeof(max) _max = max; \
|
||||||
( ( ( _x ) < ( _min ) ) ? ( _min ) : ( ( _x ) > ( _max ) ) ? ( _max) : ( _x ) ); \
|
(((_x) < (_min)) ? (_min) : ((_x) > (_max)) ? (_max) \
|
||||||
})
|
: (_x)); \
|
||||||
|
})
|
||||||
|
|
||||||
#define DegToRad(a) ( (a) * 0.01745329252f )
|
#define DegToRad(a) ((a) *0.01745329252f)
|
||||||
#define RadToDeg(a) ( (a) * 57.29577951f )
|
#define RadToDeg(a) ((a) *57.29577951f)
|
||||||
|
|
||||||
#define ALIGN4(x) (((x) + 3) & ~3)
|
#define ALIGN4(x) (((x) + 3) & ~3)
|
||||||
#define ALIGN32(x) (((x) + 31) & ~31)
|
#define ALIGN32(x) (((x) + 31) & ~31)
|
||||||
|
|
||||||
#define le16(i) ((((uint16_t) ((i) & 0xFF)) << 8) | ((uint16_t) (((i) & 0xFF00) >> 8)))
|
#define le16(i) ((((uint16_t) ((i) &0xFF)) << 8) | ((uint16_t) (((i) &0xFF00) >> 8)))
|
||||||
#define le32(i) ((((uint32_t)le16((i) & 0xFFFF)) << 16) | ((uint32_t)le16(((i) & 0xFFFF0000) >> 16)))
|
#define le32(i) ((((uint32_t) le16((i) &0xFFFF)) << 16) | ((uint32_t) le16(((i) &0xFFFF0000) >> 16)))
|
||||||
#define le64(i) ((((uint64_t)le32((i) & 0xFFFFFFFFLL)) << 32) | ((uint64_t)le32(((i) & 0xFFFFFFFF00000000LL) >> 32)))
|
#define le64(i) ((((uint64_t) le32((i) &0xFFFFFFFFLL)) << 32) | ((uint64_t) le32(((i) &0xFFFFFFFF00000000LL) >> 32)))
|
||||||
|
|
||||||
//Needs to have log_init() called beforehand.
|
//Needs to have log_init() called beforehand.
|
||||||
void dumpHex(const void *data, size_t size);
|
void dumpHex(const void *data, size_t size);
|
||||||
|
Loading…
Reference in New Issue
Block a user