Format the code via clang-format

This commit is contained in:
Maschell 2022-07-26 08:16:27 +02:00
parent 8d0f3825f6
commit 990c67d481
109 changed files with 643 additions and 608 deletions

67
.clang-format Normal file
View File

@ -0,0 +1,67 @@
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: false
ContinuationIndentWidth: 8
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Right
ReflowComments: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Never

View File

@ -6,9 +6,16 @@ on:
- main
jobs:
clang-format:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: clang-format
run: |
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source
build-binary:
runs-on: ubuntu-18.04
needs: clang-format
steps:
- uses: actions/checkout@v2
- name: Checkout submodules using a PAT

View File

@ -3,8 +3,16 @@ name: CI-PR
on: [pull_request]
jobs:
clang-format:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: clang-format
run: |
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source
build-binary:
runs-on: ubuntu-18.04
needs: clang-format
steps:
- uses: actions/checkout@v2
- name: Checkout submodules using a PAT

View File

@ -28,11 +28,15 @@ It's possible to use a docker image for building. This way you don't need anythi
```
# Build docker image (only needed once)
docker build . -t WUDD-builder
docker build . -t wudd-builder
# make
docker run -it --rm -v ${PWD}:/project WUDD-builder make
docker run -it --rm -v ${PWD}:/project wudd-builder make
# make clean
docker run -it --rm -v ${PWD}:/project WUDD-builder make clean
docker run -it --rm -v ${PWD}:/project wudd-builder make clean
```
## Format the code via docker
`docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source -i`

View File

@ -1,8 +1,9 @@
#pragma once
#include <utils/WiiUScreen.h>
#include <utils/ScreenUtils.h>
#include "input/Input.h"
#include "utils/ScreenUtils.h"
#include "utils/WiiUScreen.h"
#include <stdint.h>
class ApplicationState {
public:

View File

@ -14,15 +14,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "GMPartitionsDumperState.h"
#include <WUD/DiscReaderDiscDrive.h>
#include <WUD/NUSTitle.h>
#include <WUD/content/partitions/WiiUGMPartition.h>
#include <WUD/header/WiiUDiscHeader.h>
#include <common/common.h>
#include <fs/FSUtils.h>
#include <iosuhax.h>
#include <memory>
#include <WUD/DiscReaderDiscDrive.h>
#include <WUD/header/WiiUDiscHeader.h>
#include <fs/FSUtils.h>
#include <WUD/content/partitions/WiiUGMPartition.h>
#include <WUD/NUSTitle.h>
#include "GMPartitionsDumperState.h"
#include <utils/StringTools.h>
#define READ_BUFFER_SIZE (SECTOR_SIZE * 128)
@ -72,9 +72,9 @@ void GMPartitionsDumperState::render() {
WiiUScreen::drawLine("This disc has no dumpable GM partitions ");
} else {
uint32_t index = 0;
for (auto &partitionPair: gmPartitionPairs) {
for (auto &partitionPair : gmPartitionPairs) {
uint32_t size = 0;
for (auto &content: partitionPair.second->tmd->contentList) {
for (auto &content : partitionPair.second->tmd->contentList) {
size += ROUNDUP(content->encryptedFileSize, 16);
}
WiiUScreen::drawLinef("%s %s (~%0.2f MiB)", index == (uint32_t) selectedOptionY ? ">" : " ", partitionPair.first->getVolumeId().c_str(), (float) size / 1024.0f / 1024.0f);
@ -101,7 +101,7 @@ void GMPartitionsDumperState::render() {
uint64_t partitionSize = 0;
uint64_t partitionOffset = curOffsetInContent;
if (curNUSTitle != nullptr) {
for (auto &content: curNUSTitle->tmd->contentList) {
for (auto &content : curNUSTitle->tmd->contentList) {
partitionSize += ROUNDUP(content->encryptedFileSize, 16);
if (content->index < curContentIndex) {
partitionOffset += ROUNDUP(content->encryptedFileSize, 16);
@ -208,7 +208,7 @@ ApplicationState::eSubState GMPartitionsDumperState::update(Input *input) {
this->state = STATE_PROCESS_GM_PARTITIONS;
} else if (this->state == STATE_PROCESS_GM_PARTITIONS) {
this->gmPartitionPairs.clear();
for (auto &partition: discHeader->wiiUContentsInformation->partitions->partitions) {
for (auto &partition : discHeader->wiiUContentsInformation->partitions->partitions) {
auto gmPartition = std::dynamic_pointer_cast<WiiUGMPartition>(partition);
if (gmPartition != nullptr) {
auto nusTitleOpt = NUSTitle::loadTitleFromGMPartition(gmPartition, discReader, cKey);
@ -392,7 +392,7 @@ void GMPartitionsDumperState::setError(GMPartitionsDumperState::eErrorState err)
}
std::string GMPartitionsDumperState::getPathForDevice(eDumpTarget target) const {
if (target == TARGET_NTFS){
if (target == TARGET_NTFS) {
return "ntfs0:/";
}
return "fs:/vol/external01/";
@ -504,5 +504,3 @@ std::string GMPartitionsDumperState::ErrorDescription() const {
}
return "UNKNOWN_ERROR";
}

View File

@ -16,17 +16,18 @@
****************************************************************************/
#pragma once
#include "ApplicationState.h"
#include "common/common.h"
#include "fs/WUXFileWriter.h"
#include "fs/WriteOnlyFileWithCache.h"
#include <WUD/NUSTitle.h>
#include <WUD/entities/TMD/Content.h>
#include <WUD/header/WiiUDiscHeader.h>
#include <input/Input.h>
#include <map>
#include <memory>
#include <string>
#include <vector>
#include <memory>
#include <input/Input.h>
#include "ApplicationState.h"
#include "fs/WriteOnlyFileWithCache.h"
#include "fs/WUXFileWriter.h"
#include <WUD/entities/TMD/Content.h>
#include <WUD/NUSTitle.h>
#include <WUD/header/WiiUDiscHeader.h>
class GMPartitionsDumperState : public ApplicationState {
public:

View File

@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "MainApplicationState.h"
#include "WUDDumperState.h"
#include "GMPartitionsDumperState.h"
#include "WUDDumperState.h"
#include <sysapp/launch.h>
MainApplicationState::MainApplicationState() {
@ -24,7 +24,8 @@ MainApplicationState::MainApplicationState() {
this->state = STATE_WELCOME_SCREEN;
}
MainApplicationState::~MainApplicationState() = default;;
MainApplicationState::~MainApplicationState() = default;
;
void MainApplicationState::render() {
if (this->state == STATE_DO_SUBSTATE) {

View File

@ -16,16 +16,16 @@
****************************************************************************/
#pragma once
#include "ApplicationState.h"
#include "fs/CFile.hpp"
#include "input/Input.h"
#include <common/common.h>
#include <ctime>
#include <map>
#include <memory>
#include <string>
#include <optional>
#include <queue>
#include <ctime>
#include <common/common.h>
#include "input/Input.h"
#include "fs/CFile.hpp"
#include "ApplicationState.h"
#include <string>
class MainApplicationState : public ApplicationState {

View File

@ -53,7 +53,6 @@ std::shared_ptr<NUSDataProvider> DefaultNUSDataProcessor::getDataProvider() {
DefaultNUSDataProcessor::DefaultNUSDataProcessor(
std::shared_ptr<NUSDataProvider> pDataProvider,
std::shared_ptr<NUSDecryption> pNUSDecryption) :
dataProvider(std::move(pDataProvider)),
std::shared_ptr<NUSDecryption> pNUSDecryption) : dataProvider(std::move(pDataProvider)),
nusDecryption(std::move(pNUSDecryption)) {
}

View File

@ -16,8 +16,8 @@
****************************************************************************/
#pragma once
#include <utils/utils.h>
#include "NUSDataProcessor.h"
#include <utils/utils.h>
class DefaultNUSDataProcessor : public NUSDataProcessor {
public:

View File

@ -15,11 +15,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <WUD/content/WiiUDiscContentsHeader.h>
#include <MainApplicationState.h>
#include <utils/rijndael.h>
#include <coreinit/debug.h>
#include <WUD/content/WiiUDiscContentsHeader.h>
#include <common/common.h>
#include <coreinit/debug.h>
#include <utils/rijndael.h>
bool DiscReader::readDecryptedChunk(uint64_t readOffset, uint8_t *out_buffer, uint8_t *key, uint8_t *IV) const {
int CHUNK_SIZE = 0x10000;
@ -149,7 +149,6 @@ bool DiscReader::readEncrypted(uint8_t *buf, uint64_t offset, uint32_t size) {
totalRead += toCopy;
curOffset += missingFromPrevSector;
offsetInBuf += missingFromPrevSector;
}
if (totalRead >= size) {

View File

@ -38,6 +38,7 @@ public:
uint8_t discKey[16]{};
bool hasDiscKey = false;
private:
uint8_t *sector_buf;
};

View File

@ -14,13 +14,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "DiscReaderDiscDrive.h"
#include <MainApplicationState.h>
#include <WUD/content/WiiUDiscContentsHeader.h>
#include <common/common.h>
#include <MainApplicationState.h>
#include <iosuhax.h>
#include <utils/rijndael.h>
#include <utils/logger.h>
#include "DiscReaderDiscDrive.h"
#include <utils/rijndael.h>
DiscReaderDiscDrive::DiscReaderDiscDrive() : DiscReader() {

View File

@ -16,9 +16,9 @@
****************************************************************************/
#pragma once
#include "DiscReader.h"
#include <cstdint>
#include <optional>
#include "DiscReader.h"
class DiscReaderDiscDrive : public DiscReader {
public:

View File

@ -16,9 +16,9 @@
****************************************************************************/
#pragma once
#include <cstdint>
#include <WUD/entities/TMD/Content.h>
#include <WUD/entities/FST/FST.h>
#include <WUD/entities/TMD/Content.h>
#include <cstdint>
class NUSDataProvider {
@ -36,6 +36,5 @@ public:
virtual bool getRawCert(std::vector<uint8_t> &out_data) = 0;
virtual void setFST(const std::shared_ptr<FST> &fst) {
}
};

View File

@ -48,7 +48,7 @@ bool NUSDataProviderWUD::getContentH3Hash(const std::shared_ptr<Content> &conten
void NUSDataProviderWUD::setFST(const std::shared_ptr<FST> &pFST) {
// We need to set the correct blocksizes
auto blockSize = gamePartition->getVolumes().begin()->second->blockSize;
for (const auto &e: pFST->sectionEntries->getSections()) {
for (const auto &e : pFST->sectionEntries->getSections()) {
e->address = AddressInVolumeBlocks(blockSize, e->address.value);
e->size = SizeInVolumeBlocks(blockSize, e->size.value);
}

View File

@ -16,11 +16,11 @@
****************************************************************************/
#pragma once
#include <WUD/content/partitions/WiiUGMPartition.h>
#include "NUSDataProvider.h"
#include "DiscReader.h"
#include <utils/FSTUtils.h>
#include "NUSDataProvider.h"
#include <WUD/content/partitions/WiiUGMPartition.h>
#include <coreinit/debug.h>
#include <utils/FSTUtils.h>
class NUSDataProviderWUD : public NUSDataProvider {

View File

@ -84,7 +84,6 @@ NUSTitle::NUSTitle(std::shared_ptr<TitleMetaData> pTMD,
fst(std::move(pFST)),
decryption(std::move(pDecryption)),
dataProvider(std::move(pDataProvider)) {
}
std::optional<std::shared_ptr<NUSTitle>>

View File

@ -16,15 +16,15 @@
****************************************************************************/
#pragma once
#include <WUD/NUSDataProvider.h>
#include <WUD/entities/TMD/TitleMetaData.h>
#include <WUD/content/partitions/WiiUGMPartition.h>
#include "Ticket.h"
#include "NUSDataProcessor.h"
#include "NUSDecryption.h"
#include "DefaultNUSDataProcessor.h"
#include "DiscReaderDiscDrive.h"
#include "NUSDataProcessor.h"
#include "NUSDataProviderWUD.h"
#include "NUSDecryption.h"
#include "Ticket.h"
#include <WUD/NUSDataProvider.h>
#include <WUD/content/partitions/WiiUGMPartition.h>
#include <WUD/entities/TMD/TitleMetaData.h>
class NUSTitle {
@ -52,5 +52,4 @@ private:
std::shared_ptr<NUSDecryption> pDecryption,
std::shared_ptr<Ticket> pTicket,
std::shared_ptr<FST> pFST);
};

View File

@ -18,8 +18,7 @@
#include <algorithm>
#include <utils/logger.h>
Ticket::Ticket(const std::array<uint8_t, 16> &pEncryptedKey, const std::array<uint8_t, 16> &pDecryptedKey) :
ticketKeyEnc(pEncryptedKey),
Ticket::Ticket(const std::array<uint8_t, 16> &pEncryptedKey, const std::array<uint8_t, 16> &pDecryptedKey) : ticketKeyEnc(pEncryptedKey),
ticketKeyDec(pDecryptedKey) {
}

View File

@ -17,10 +17,10 @@
#pragma once
#include <cstdint>
#include <utils/rijndael.h>
#include <cstring>
#include <optional>
#include <memory>
#include <optional>
#include <utils/rijndael.h>
#include <vector>
class Ticket {

View File

@ -14,8 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <coreinit/debug.h>
#include "WiiUContentsInformation.h"
#include <coreinit/debug.h>
uint32_t WiiUContentsInformation::LENGTH = 32768;
@ -47,9 +47,7 @@ std::optional<std::unique_ptr<WiiUContentsInformation>> WiiUContentsInformation:
WiiUContentsInformation::WiiUContentsInformation(std::unique_ptr<WiiUDiscContentsHeader> pDiscContentHeader,
std::unique_ptr<WiiUPartitions> pPartitions) :
discContentHeader(std::move(pDiscContentHeader)),
partitions(std::move(pPartitions)) {
};
std::unique_ptr<WiiUPartitions> pPartitions) : discContentHeader(std::move(pDiscContentHeader)),
partitions(std::move(pPartitions)){
};

View File

@ -16,10 +16,10 @@
****************************************************************************/
#pragma once
#include <memory>
#include <WUD/DiscReader.h>
#include "WiiUDiscContentsHeader.h"
#include "partitions/WiiUPartitions.h"
#include <WUD/DiscReader.h>
#include <memory>
class WiiUContentsInformation {

View File

@ -14,9 +14,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <utils/blocksize/DiscBlockSize.h>
#include <coreinit/debug.h>
#include "WiiUDiscContentsHeader.h"
#include <coreinit/debug.h>
#include <utils/blocksize/DiscBlockSize.h>
std::optional<std::unique_ptr<WiiUDiscContentsHeader>> WiiUDiscContentsHeader::make_unique(const std::shared_ptr<DiscReader> &discReader, uint32_t offset) {
auto *buffer = (uint8_t *) malloc(LENGTH);
@ -49,10 +49,7 @@ std::optional<std::unique_ptr<WiiUDiscContentsHeader>> WiiUDiscContentsHeader::m
return std::unique_ptr<WiiUDiscContentsHeader>(new WiiUDiscContentsHeader(blockSize, tocHash, numberOfPartition));
}
WiiUDiscContentsHeader::WiiUDiscContentsHeader(DiscBlockSize pSize, const std::array<uint8_t, 20> &pTocHash, uint32_t pNumberOfPartitions) :
blockSize(pSize),
WiiUDiscContentsHeader::WiiUDiscContentsHeader(DiscBlockSize pSize, const std::array<uint8_t, 20> &pTocHash, uint32_t pNumberOfPartitions) : blockSize(pSize),
numberOfPartition(pNumberOfPartitions),
tocHash(pTocHash) {
}

View File

@ -16,11 +16,11 @@
****************************************************************************/
#pragma once
#include <WUD/DiscReader.h>
#include <algorithm>
#include <memory>
#include <WUD/DiscReader.h>
#include <utils/blocksize/DiscBlockSize.h>
#include <optional>
#include <utils/blocksize/DiscBlockSize.h>
class WiiUDiscContentsHeader {

View File

@ -22,17 +22,15 @@ WiiUDataPartition::~WiiUDataPartition() = default;
WiiUDataPartition::WiiUDataPartition(
std::shared_ptr<WiiUPartition> pPartition,
std::shared_ptr<FST> pFST) :
fst(std::move(pFST)),
std::shared_ptr<FST> pFST) : fst(std::move(pFST)),
basePartition(std::move(pPartition)) {
}
std::string WiiUDataPartition::getVolumeId() const &{
std::string WiiUDataPartition::getVolumeId() const & {
return basePartition->getVolumeId();
}
std::map<AddressInDiscBlocks, std::shared_ptr<VolumeHeader>> WiiUDataPartition::getVolumes() const &{
std::map<AddressInDiscBlocks, std::shared_ptr<VolumeHeader>> WiiUDataPartition::getVolumes() const & {
return basePartition->getVolumes();
}

View File

@ -16,11 +16,11 @@
****************************************************************************/
#pragma once
#include "WiiUPartition.h"
#include <WUD/entities/FST/FST.h>
#include <cstdint>
#include <cstdlib>
#include <WUD/entities/FST/FST.h>
#include <utils/blocksize/AddressInDiscBlocks.h>
#include "WiiUPartition.h"
class WiiUDataPartition : public WiiUPartition {
@ -43,4 +43,3 @@ public:
private:
std::shared_ptr<WiiUPartition> basePartition;
};

View File

@ -27,11 +27,11 @@ WiiUGMPartition::WiiUGMPartition(std::shared_ptr<WiiUPartition> partition,
basePartition(std::move(partition)) {
}
std::string WiiUGMPartition::getVolumeId() const &{
std::string WiiUGMPartition::getVolumeId() const & {
return basePartition->getVolumeId();
}
std::map<AddressInDiscBlocks, std::shared_ptr<VolumeHeader>> WiiUGMPartition::getVolumes() const &{
std::map<AddressInDiscBlocks, std::shared_ptr<VolumeHeader>> WiiUGMPartition::getVolumes() const & {
return basePartition->getVolumes();
}

View File

@ -16,10 +16,10 @@
****************************************************************************/
#pragma once
#include <memory>
#include "WiiUPartition.h"
#include <cstdint>
#include <cstdlib>
#include "WiiUPartition.h"
#include <memory>
class WiiUGMPartition : public WiiUPartition {
public:
@ -43,4 +43,3 @@ public:
private:
std::shared_ptr<WiiUPartition> basePartition;
};

View File

@ -14,9 +14,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <memory>
#include <coreinit/debug.h>
#include "WiiUPartition.h"
#include <coreinit/debug.h>
#include <memory>
uint64_t WiiUPartition::getSectionOffsetOnDefaultPartition() {
if (volumes.size() != 1) {
@ -77,11 +77,11 @@ std::optional<std::shared_ptr<WiiUPartition>> WiiUPartition::make_shared(const s
fileSystemDescriptor));
}
std::string WiiUPartition::getVolumeId() const &{
std::string WiiUPartition::getVolumeId() const & {
return volumeId;
}
std::map<AddressInDiscBlocks, std::shared_ptr<VolumeHeader>> WiiUPartition::getVolumes() const &{
std::map<AddressInDiscBlocks, std::shared_ptr<VolumeHeader>> WiiUPartition::getVolumes() const & {
return volumes;
}
@ -90,7 +90,3 @@ uint16_t WiiUPartition::getFileSystemDescriptor() const {
}
WiiUPartition::~WiiUPartition() = default;

View File

@ -16,11 +16,12 @@
****************************************************************************/
#pragma once
#include <map>
#include <utility>
#include <utils/blocksize/DiscBlockSize.h>
#include <utils/blocksize/AddressInDiscBlocks.h>
#include "volumes/VolumeHeader.h"
#include <map>
#include <memory>
#include <utility>
#include <utils/blocksize/AddressInDiscBlocks.h>
#include <utils/blocksize/DiscBlockSize.h>
class WiiUPartition {

View File

@ -14,13 +14,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <utils/FSTUtils.h>
#include <coreinit/debug.h>
#include <utils/FSTUtils.h>
#include <utility>
#include "WiiUPartitions.h"
#include "WiiUGMPartition.h"
#include "WiiUDataPartition.h"
#include "WiiUGMPartition.h"
#include "WiiUPartitions.h"
#include <utility>
bool WiiUPartitions::getFSTEntryAsByte(std::string &filePath,
const std::shared_ptr<FST> &fst,
@ -70,7 +70,7 @@ WiiUPartitions::make_unique(const std::shared_ptr<DiscReader> &discReader, uint3
tmp.push_back(partitionOpt.value());
}
std::optional<std::shared_ptr<WiiUPartition>> SIPartition;
for (auto &partition: tmp) {
for (auto &partition : tmp) {
if (partition->getVolumeId().starts_with("SI")) {
SIPartition = partition;
break;
@ -78,7 +78,7 @@ WiiUPartitions::make_unique(const std::shared_ptr<DiscReader> &discReader, uint3
}
if (SIPartition.has_value()) {
for (auto const&[key, val]: SIPartition.value()->getVolumes()) {
for (auto const &[key, val] : SIPartition.value()->getVolumes()) {
auto volumeAddress = key;
auto volumeAddressInBytes = volumeAddress.getAddressInBytes();
auto volumeHeader = val;
@ -106,7 +106,7 @@ WiiUPartitions::make_unique(const std::shared_ptr<DiscReader> &discReader, uint3
return {};
}
for (auto &child: siFST.value()->getRootEntry()->getDirChildren()) {
for (auto &child : siFST.value()->getRootEntry()->getDirChildren()) {
std::vector<uint8_t> bufferTicket;
std::string tikFilePath = std::string(child->getFullPath() + '/' + WUD_TICKET_FILENAME);
if (!getFSTEntryAsByte(tikFilePath, siFST.value(), volumeAddress, discReader, bufferTicket)) {
@ -135,7 +135,7 @@ WiiUPartitions::make_unique(const std::shared_ptr<DiscReader> &discReader, uint3
std::string partitionName = std::string("GM") + partitionNameRaw;
std::optional<std::shared_ptr<WiiUPartition>> curPartition;
for (auto &partition: tmp) {
for (auto &partition : tmp) {
if (partition->getVolumeId().starts_with(partitionName)) {
curPartition = partition;
break;
@ -151,10 +151,9 @@ WiiUPartitions::make_unique(const std::shared_ptr<DiscReader> &discReader, uint3
partitions.push_back(gmPartition);
}
}
}
for (auto &partition: tmp) {
for (auto &partition : tmp) {
if (partition->getVolumeId().starts_with("GM")) {
continue;
}
@ -190,4 +189,3 @@ WiiUPartitions::make_unique(const std::shared_ptr<DiscReader> &discReader, uint3
WiiUPartitions::WiiUPartitions(std::vector<std::shared_ptr<WiiUPartition>> pPartitions) : partitions(std::move(pPartitions)) {
}

View File

@ -16,13 +16,13 @@
****************************************************************************/
#pragma once
#include <memory>
#include <cstdint>
#include <utils/blocksize/DiscBlockSize.h>
#include <utils/blocksize/AddressInDiscBlocks.h>
#include <WUD/entities/FST/FST.h>
#include <WUD/DiscReader.h>
#include "WiiUPartition.h"
#include <WUD/DiscReader.h>
#include <WUD/entities/FST/FST.h>
#include <cstdint>
#include <memory>
#include <utils/blocksize/AddressInDiscBlocks.h>
#include <utils/blocksize/DiscBlockSize.h>
#define WUD_TMD_FILENAME "title.tmd"
#define WUD_TICKET_FILENAME "title.tik"

View File

@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "H3HashArray.h"
#include <cstring>
#include <coreinit/debug.h>
#include <cstring>
H3HashArray::H3HashArray(uint8_t *pData, uint32_t pSize) {
size = pSize;

View File

@ -15,9 +15,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <memory>
#include "VolumeHeader.h"
#include <coreinit/debug.h>
#include <memory>
#include <utils/logger.h>
uint32_t VolumeHeader::MAGIC = 0xCC93A4F5;
@ -123,5 +123,3 @@ VolumeHeader::VolumeHeader(const VolumeBlockSize &pBlockSize,
h3HashArrayListSize(pH3HashArrayListSize),
numberOfH3HashArray(pNumberOfH3HashArray) {
}

View File

@ -16,16 +16,17 @@
****************************************************************************/
#pragma once
#include <utility>
#include <vector>
#include <cstdint>
#include "H3HashArray.h"
#include <WUD/DiscReader.h>
#include <utils/blocksize/VolumeBlockSize.h>
#include <cstdint>
#include <memory>
#include <optional>
#include <utility>
#include <utils/blocksize/AddressInVolumeBlocks.h>
#include <utils/blocksize/SizeInVolumeBlocks.h>
#include <optional>
#include <utils/blocksize/VolumeBlockSize.h>
#include <utils/utils.h>
#include "H3HashArray.h"
#include <vector>
class VolumeHeader {
@ -63,5 +64,4 @@ private:
std::vector<std::shared_ptr<H3HashArray>> pH3HashArrayList,
uint32_t pH3HashArrayListSize,
uint32_t pNumberOfH3HashArray);
};

View File

@ -85,10 +85,8 @@ std::optional<std::shared_ptr<FST>> FST::make_shared(const std::vector<uint8_t>
FST::FST(std::unique_ptr<FSTHeader> pHeader,
std::shared_ptr<SectionEntries> pSectionEntries,
std::shared_ptr<StringTable> pStringTable,
std::unique_ptr<NodeEntries> pNodeEntries) :
sectionEntries(std::move(pSectionEntries)),
std::unique_ptr<NodeEntries> pNodeEntries) : sectionEntries(std::move(pSectionEntries)),
stringTable(std::move(pStringTable)),
nodeEntries(std::move(pNodeEntries)),
header(std::move(pHeader)) {
}

View File

@ -16,15 +16,15 @@
****************************************************************************/
#pragma once
#include <optional>
#include <memory>
#include <cstdint>
#include <utility>
#include <WUD/entities/FST/header/FSTHeader.h>
#include <WUD/entities/FST/sectionentry/SectionEntries.h>
#include <WUD/entities/FST/stringtable/StringTable.h>
#include <WUD/entities/FST/nodeentry/NodeEntries.h>
#include <WUD/entities/FST/nodeentry/RootEntry.h>
#include <WUD/entities/FST/sectionentry/SectionEntries.h>
#include <WUD/entities/FST/stringtable/StringTable.h>
#include <cstdint>
#include <memory>
#include <optional>
#include <utility>
class FST {
public:
@ -33,12 +33,12 @@ public:
static std::optional<std::shared_ptr<FST>> make_shared(const std::vector<uint8_t> &data, uint32_t offset, const VolumeBlockSize &blockSize);
std::shared_ptr<SectionEntries> sectionEntries;
private:
FST(std::unique_ptr<FSTHeader> pHeader,
std::shared_ptr<SectionEntries> pSectionEntries,
std::shared_ptr<StringTable> pStringTable,
std::unique_ptr<NodeEntries> pNodeEntries
);
std::unique_ptr<NodeEntries> pNodeEntries);
std::shared_ptr<StringTable> stringTable;
std::unique_ptr<NodeEntries> nodeEntries;

View File

@ -14,9 +14,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "FSTHeader.h"
#include <utils/blocksize/SectionBlockSize.h>
#include <utils/logger.h>
#include "FSTHeader.h"
std::optional<std::unique_ptr<FSTHeader>> FSTHeader::make_unique(const std::array<uint8_t, FSTHeader::LENGTH> &data) {
auto *dataAsUint = (uint32_t *) data.data();
@ -33,13 +33,11 @@ std::optional<std::unique_ptr<FSTHeader>> FSTHeader::make_unique(const std::arra
FSTVersion,
blockSize,
numberOfSections,
hashDisabled
));
hashDisabled));
}
FSTHeader::FSTHeader(uint8_t pFSTVersion, SectionBlockSize pBlockSize, uint32_t pNumberOfSections, uint8_t pHashDisabled) : FSTVersion(pFSTVersion),
blockSize(pBlockSize),
numberOfSections(pNumberOfSections),
hashDisabled(pHashDisabled) {
}

View File

@ -16,9 +16,9 @@
****************************************************************************/
#pragma once
#include <optional>
#include <memory>
#include <cstdint>
#include <memory>
#include <optional>
#include <utils/blocksize/SectionBlockSize.h>
class FSTHeader {
@ -35,5 +35,4 @@ public:
private:
FSTHeader(uint8_t pFSTVersion, SectionBlockSize pBlockSize, uint32_t pNumberOfSections, uint8_t pHashDisabled);
};

View File

@ -14,8 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <coreinit/debug.h>
#include "DirectoryEntry.h"
#include <coreinit/debug.h>
std::optional<std::shared_ptr<DirectoryEntry>>
DirectoryEntry::parseData(const std::array<uint8_t, NodeEntry::LENGTH> &data, const NodeEntryParam &param, const std::shared_ptr<SectionEntries> &sectionEntries,
@ -40,7 +40,7 @@ DirectoryEntry::parseData(const std::array<uint8_t, NodeEntry::LENGTH> &data, co
std::vector<std::shared_ptr<DirectoryEntry>> DirectoryEntry::getDirChildren() const {
std::vector<std::shared_ptr<DirectoryEntry>> res;
for (auto &cur: children) {
for (auto &cur : children) {
if (cur->isDirectory()) {
res.push_back(std::dynamic_pointer_cast<DirectoryEntry>(cur));
}
@ -50,7 +50,7 @@ std::vector<std::shared_ptr<DirectoryEntry>> DirectoryEntry::getDirChildren() co
std::vector<std::shared_ptr<FileEntry>> DirectoryEntry::getFileChildren() const {
std::vector<std::shared_ptr<FileEntry>> res;
for (auto &cur: children) {
for (auto &cur : children) {
if (cur->isFile()) {
res.push_back(std::dynamic_pointer_cast<FileEntry>(cur));
}
@ -64,7 +64,7 @@ std::vector<std::shared_ptr<NodeEntry>> DirectoryEntry::getChildren() const {
void DirectoryEntry::printPathRecursive() {
DEBUG_FUNCTION_LINE("%s", getFullPath().c_str());
for (auto &child: children) {
for (auto &child : children) {
child->printPathRecursive();
}
}
@ -77,8 +77,7 @@ DirectoryEntry::DirectoryEntry(const NodeEntryParam &param,
const std::shared_ptr<StringEntry> &pStringEntry,
const std::shared_ptr<SectionEntry> &pSectionEntry,
uint32_t pParentEntryNumber,
uint32_t pLastEntryNumber) :
NodeEntry(param.permission,
uint32_t pLastEntryNumber) : NodeEntry(param.permission,
pStringEntry,
pSectionEntry,
param.parent,
@ -88,8 +87,7 @@ DirectoryEntry::DirectoryEntry(const NodeEntryParam &param,
lastEntryNumber(pLastEntryNumber) {
}
DirectoryEntry::DirectoryEntry(const std::shared_ptr<DirectoryEntry> &input) :
NodeEntry(input->permission,
DirectoryEntry::DirectoryEntry(const std::shared_ptr<DirectoryEntry> &input) : NodeEntry(input->permission,
input->nameString,
input->sectionEntry,
input->parent,
@ -97,5 +95,4 @@ DirectoryEntry::DirectoryEntry(const std::shared_ptr<DirectoryEntry> &input) :
input->entryNumber),
parentEntryNumber(input->parentEntryNumber),
lastEntryNumber(input->lastEntryNumber) {
}

View File

@ -16,11 +16,11 @@
****************************************************************************/
#pragma once
#include "FileEntry.h"
#include "NodeEntry.h"
#include "NodeEntryParam.h"
#include <WUD/entities/FST/sectionentry/SectionEntries.h>
#include <WUD/entities/FST/stringtable/StringTable.h>
#include "NodeEntryParam.h"
#include "NodeEntry.h"
#include "FileEntry.h"
class DirectoryEntry : public NodeEntry {
public:

View File

@ -61,8 +61,7 @@ FileEntry::FileEntry(
const NodeEntryParam &param,
const std::shared_ptr<StringEntry> &pStringEntry,
const std::shared_ptr<SectionEntry> &pSectionEntry,
uint32_t pSize, SectionAddress pAddress) :
NodeEntry(param.permission,
uint32_t pSize, SectionAddress pAddress) : NodeEntry(param.permission,
pStringEntry,
pSectionEntry,
param.parent,
@ -70,5 +69,4 @@ FileEntry::FileEntry(
param.entryNumber),
address(std::move(pAddress)),
size(pSize) {
}

View File

@ -23,7 +23,6 @@
class FileEntry : public NodeEntry {
public:
static std::optional<std::shared_ptr<NodeEntry>>
parseData(const std::array<uint8_t, NodeEntry::LENGTH> &data,
const NodeEntryParam &param,

View File

@ -14,8 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <coreinit/debug.h>
#include "NodeEntries.h"
#include <coreinit/debug.h>
std::optional<std::shared_ptr<NodeEntry>> NodeEntries::DeserializeImpl(const std::vector<uint8_t> &pData,
uint32_t pOffset,

View File

@ -16,15 +16,15 @@
****************************************************************************/
#pragma once
#include <WUD/entities/FST/sectionentry/SectionEntries.h>
#include <WUD/entities/FST/stringtable/StringTable.h>
#include <utils/blocksize/SectionBlockSize.h>
#include <WUD/entities/FST/sectionentry/SectionEntries.h>
#include <utility>
#include "DirectoryEntry.h"
#include "RootEntry.h"
#include "NodeEntry.h"
#include "NodeEntries.h"
#include "NodeEntry.h"
#include "RootEntry.h"
#include <utility>
class NodeEntries {

View File

@ -14,15 +14,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <utils/blocksize/SectionBlockSize.h>
#include <WUD/entities/FST/stringtable/StringTable.h>
#include <WUD/entities/FST/sectionentry/SectionEntries.h>
#include <WUD/entities/FST/stringtable/StringTable.h>
#include <utils/blocksize/SectionBlockSize.h>
#include "DirectoryEntry.h"
#include "NodeEntry.h"
#include "RootEntry.h"
#include <algorithm>
#include <utility>
#include "NodeEntry.h"
#include "DirectoryEntry.h"
#include "RootEntry.h"
std::optional<std::shared_ptr<NodeEntry>>
NodeEntry::AutoDeserialize(const std::vector<uint8_t> &data,
@ -123,17 +123,14 @@ NodeEntry::NodeEntry(const uint16_t pPermission,
std::shared_ptr<StringEntry> pNameString,
std::shared_ptr<SectionEntry> pSectionEntry,
std::optional<std::shared_ptr<DirectoryEntry>> pParent,
const uint8_t pType, const uint32_t pEntryNumber) :
permission(pPermission),
const uint8_t pType, const uint32_t pEntryNumber) : permission(pPermission),
nameString(std::move(pNameString)),
sectionEntry(std::move(pSectionEntry)),
parent(std::move(pParent)),
entryType(pType),
entryNumber(pEntryNumber) {
}
void NodeEntry::printPathRecursive() {
DEBUG_FUNCTION_LINE("%s", getFullPath().c_str());
}

View File

@ -16,13 +16,13 @@
****************************************************************************/
#pragma once
#include "NodeEntryParam.h"
#include <WUD/entities/FST/sectionentry/SectionEntries.h>
#include <WUD/entities/FST/sectionentry/SectionEntry.h>
#include <WUD/entities/FST/stringtable/StringEntry.h>
#include <cstdint>
#include <utils/blocksize/SectionBlockSize.h>
#include <WUD/entities/FST/stringtable/StringEntry.h>
#include <WUD/entities/FST/sectionentry/SectionEntry.h>
#include <WUD/entities/FST/sectionentry/SectionEntries.h>
#include <utils/logger.h>
#include "NodeEntryParam.h"
#define ENTRY_TYPE_File 0
#define ENTRY_TYPE_Directory 1

View File

@ -17,6 +17,8 @@
#pragma once
#include <cstdint>
#include <memory>
#include <optional>
class DirectoryEntry;

View File

@ -14,11 +14,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <coreinit/debug.h>
#include "RootEntry.h"
#include <coreinit/debug.h>
RootEntry::RootEntry(const std::shared_ptr<DirectoryEntry> &input) : DirectoryEntry(input) {
}
uint32_t RootEntry::parseLastEntryNumber(const std::array<uint8_t, NodeEntry::LENGTH> &data) {
@ -26,8 +25,7 @@ uint32_t RootEntry::parseLastEntryNumber(const std::array<uint8_t, NodeEntry::LE
}
std::optional<std::shared_ptr<NodeEntry>>
RootEntry::parseData
(const std::array<uint8_t, NodeEntry::LENGTH> &data,
RootEntry::parseData(const std::array<uint8_t, NodeEntry::LENGTH> &data,
const NodeEntryParam &param,
const std::shared_ptr<SectionEntries> &sectionEntries,
const std::shared_ptr<StringTable> &stringTable) {

View File

@ -16,11 +16,11 @@
****************************************************************************/
#pragma once
#include <cstdint>
#include <WUD/entities/FST/stringtable/StringTable.h>
#include <utils/blocksize/SectionBlockSize.h>
#include <WUD/entities/FST/sectionentry/SectionEntries.h>
#include "DirectoryEntry.h"
#include <WUD/entities/FST/sectionentry/SectionEntries.h>
#include <WUD/entities/FST/stringtable/StringTable.h>
#include <cstdint>
#include <utils/blocksize/SectionBlockSize.h>
class RootEntry : public DirectoryEntry {

View File

@ -17,7 +17,7 @@
#include "SectionEntries.h"
std::optional<std::shared_ptr<SectionEntry>> SectionEntries::getSection(uint16_t sectionNumber) const {
for (auto const &e: list) {
for (auto const &e : list) {
if (e->sectionNumber == sectionNumber) {
return e;
}
@ -42,15 +42,15 @@ std::optional<std::shared_ptr<SectionEntries>> SectionEntries::make_shared(const
}
std::array<uint8_t, SectionEntry::LENGTH> sectionEntryData{};
memcpy(sectionEntryData.data(), data.data() + (i * SectionEntry::LENGTH), SectionEntry::LENGTH);
list.push_back(std::make_shared<SectionEntry>(sectionEntryData, i, pBlockSize));;
list.push_back(std::make_shared<SectionEntry>(sectionEntryData, i, pBlockSize));
;
}
return std::shared_ptr<SectionEntries>(new SectionEntries(list));
}
std::vector<std::shared_ptr<SectionEntry>> SectionEntries::getSections() const &{
std::vector<std::shared_ptr<SectionEntry>> SectionEntries::getSections() const & {
return list;
}
SectionEntries::SectionEntries(std::vector<std::shared_ptr<SectionEntry>> pList) : list(std::move(pList)) {
}

View File

@ -16,14 +16,14 @@
****************************************************************************/
#pragma once
#include <optional>
#include <memory>
#include "SectionEntry.h"
#include <cstdint>
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include <utils/blocksize/VolumeBlockSize.h>
#include <utils/logger.h>
#include "SectionEntry.h"
#include <vector>
class SectionEntries {

View File

@ -16,9 +16,9 @@
****************************************************************************/
#pragma once
#include <array>
#include <cstdint>
#include <string>
#include <array>
#include <utils/blocksize/AddressInVolumeBlocks.h>
#include <utils/blocksize/SizeInVolumeBlocks.h>

View File

@ -16,9 +16,9 @@
****************************************************************************/
#include "StringEntry.h"
#include "StringTable.h"
#include <utility>
#include <utils/logger.h>
#include "StringTable.h"
std::optional<std::string> StringEntry::toString() const {
return stringTable->getByAddress(offset);

View File

@ -17,9 +17,9 @@
#pragma once
#include <cstdint>
#include <string>
#include <memory>
#include <optional>
#include <string>
class StringTable;

View File

@ -14,10 +14,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <cstring>
#include <coreinit/debug.h>
#include <utils/logger.h>
#include "StringTable.h"
#include <coreinit/debug.h>
#include <cstring>
#include <utils/logger.h>
std::optional<std::shared_ptr<StringTable>> StringTable::make_shared(const std::vector<uint8_t> &data, uint32_t offset, uint32_t stringCount) {
@ -67,14 +67,14 @@ std::optional<std::shared_ptr<StringEntry>> StringTable::getStringEntry(uint32_t
uint32_t StringTable::getSize() {
uint32_t capacity = 1; // root entry
for (auto &cur: strings) {
for (auto &cur : strings) {
capacity += cur.second.length() + 1;
}
return capacity;
}
std::optional<std::shared_ptr<StringEntry>> StringTable::getEntry(std::string &str) {
for (auto &cur: strings) {
for (auto &cur : strings) {
if (cur.second == str) {
return stringMap[cur.first];
}

View File

@ -16,12 +16,12 @@
****************************************************************************/
#pragma once
#include <optional>
#include <memory>
#include <vector>
#include <string>
#include <map>
#include "StringEntry.h"
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <vector>
class StringTable {

View File

@ -14,11 +14,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <cstring>
#include "Content.h"
#include <cstring>
Content::Content(uint32_t pId, uint16_t pIndex, uint16_t pType, uint64_t pEncryptedFileSize, const std::array<uint8_t, 0x14> &pHash) :
ID(pId),
Content::Content(uint32_t pId, uint16_t pIndex, uint16_t pType, uint64_t pEncryptedFileSize, const std::array<uint8_t, 0x14> &pHash) : ID(pId),
index(pIndex),
type(pType),
encryptedFileSize(pEncryptedFileSize),

View File

@ -17,8 +17,8 @@
#pragma once
#include <cstdint>
#include <optional>
#include <memory>
#include <optional>
class Content {
public:

View File

@ -22,11 +22,10 @@
TitleMetaData::TitleMetaData(std::vector<std::shared_ptr<Content>> pContentList) : contentList(std::move(pContentList)) {
// Get Contents
}
std::optional<std::shared_ptr<Content>> TitleMetaData::getContentByIndex(uint16_t i) {
for (auto &content: contentList) {
for (auto &content : contentList) {
if (content->index == i) {
return content;
}

View File

@ -16,11 +16,11 @@
****************************************************************************/
#pragma once
#include <optional>
#include <memory>
#include <cstdint>
#include <vector>
#include "Content.h"
#include <cstdint>
#include <memory>
#include <optional>
#include <vector>
class TitleMetaData {
public:

View File

@ -21,8 +21,7 @@ uint32_t WiiUDiscHeader::LENGTH = 131072L;
WiiUDiscHeader::WiiUDiscHeader(std::unique_ptr<WiiUManufactorDiscId> pManufactorDiscId,
std::unique_ptr<WiiUDiscId> pDiscId,
std::unique_ptr<WiiUContentsInformation> pWiiUContentsInformation) :
manufactorDiscId(std::move(pManufactorDiscId)),
std::unique_ptr<WiiUContentsInformation> pWiiUContentsInformation) : manufactorDiscId(std::move(pManufactorDiscId)),
discId(std::move(pDiscId)),
wiiUContentsInformation(std::move(pWiiUContentsInformation)) {
}

View File

@ -16,17 +16,16 @@
****************************************************************************/
#pragma once
#include <cstdint>
#include <WUD/DiscReader.h>
#include <WUD/content/WiiUContentsInformation.h>
#include <WUD/DiscReaderDiscDrive.h>
#include <memory>
#include "WiiUManufactorDiscId.h"
#include "WiiUDiscId.h"
#include "WiiUManufactorDiscId.h"
#include <WUD/DiscReader.h>
#include <WUD/DiscReaderDiscDrive.h>
#include <WUD/content/WiiUContentsInformation.h>
#include <cstdint>
#include <memory>
class WiiUDiscHeader {
public:
static std::optional<std::unique_ptr<WiiUDiscHeader>> make_unique(const std::shared_ptr<DiscReader> &discReader);
std::unique_ptr<WiiUManufactorDiscId> manufactorDiscId;
@ -39,6 +38,5 @@ private:
explicit WiiUDiscHeader(
std::unique_ptr<WiiUManufactorDiscId> pManufactorDiscId,
std::unique_ptr<WiiUDiscId> pDiscId,
std::unique_ptr<WiiUContentsInformation> pWiiUContentsInformation
);
std::unique_ptr<WiiUContentsInformation> pWiiUContentsInformation);
};

View File

@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "WiiUDiscId.h"
#include <memory>
#include <coreinit/debug.h>
#include <memory>
#include <utils/logger.h>
std::optional<std::unique_ptr<WiiUDiscId>> WiiUDiscId::make_unique(const std::shared_ptr<DiscReader> &discReader, uint32_t offset) {
@ -46,9 +46,7 @@ std::optional<std::unique_ptr<WiiUDiscId>> WiiUDiscId::make_unique(const std::sh
return std::unique_ptr<WiiUDiscId>(new WiiUDiscId(minorVersion, majorVersion, footprint));
}
WiiUDiscId::WiiUDiscId(uint8_t pMinorVersion, uint8_t pMajorVersion, const std::string &pFootprint) :
minorVersion(pMinorVersion),
WiiUDiscId::WiiUDiscId(uint8_t pMinorVersion, uint8_t pMajorVersion, const std::string &pFootprint) : minorVersion(pMinorVersion),
majorVersion(pMajorVersion),
footprint(pFootprint) {
}

View File

@ -16,10 +16,10 @@
****************************************************************************/
#pragma once
#include <memory>
#include <string>
#include <WUD/DiscReader.h>
#include <memory>
#include <optional>
#include <string>
#include <utility>
class WiiUDiscId {

View File

@ -16,9 +16,9 @@
****************************************************************************/
#pragma once
#include <memory>
#include <cstdint>
#include <WUD/DiscReader.h>
#include <cstdint>
#include <memory>
#include <optional>
class WiiUManufactorDiscId {

View File

@ -14,15 +14,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <malloc.h>
#include <utils/WiiUScreen.h>
#include <common/common.h>
#include <iosuhax.h>
#include <fs/FSUtils.h>
#include <utils/StringTools.h>
#include <utils/utils.h>
#include <WUD/content/WiiUDiscContentsHeader.h>
#include "WUDDumperState.h"
#include <WUD/content/WiiUDiscContentsHeader.h>
#include <common/common.h>
#include <fs/FSUtils.h>
#include <iosuhax.h>
#include <malloc.h>
#include <utils/StringTools.h>
#include <utils/WiiUScreen.h>
#include <utils/utils.h>
WUDDumperState::WUDDumperState(WUDDumperState::eDumpTargetFormat pTargetFormat, eDumpTarget pTargetDevice)
: targetFormat(pTargetFormat), targetDevice(pTargetDevice) {

View File

@ -16,15 +16,15 @@
****************************************************************************/
#pragma once
#include "ApplicationState.h"
#include "fs/WUXFileWriter.h"
#include "fs/WriteOnlyFileWithCache.h"
#include <common/common.h>
#include <input/Input.h>
#include <map>
#include <memory>
#include <string>
#include <vector>
#include <memory>
#include <input/Input.h>
#include <common/common.h>
#include "ApplicationState.h"
#include "fs/WriteOnlyFileWithCache.h"
#include "fs/WUXFileWriter.h"
#define READ_NUM_SECTORS 128
#define WRITE_BUFFER_NUM_SECTORS 128
@ -32,7 +32,6 @@
class WUDDumperState : public ApplicationState {
public:
enum eDumpTargetFormat {
DUMP_AS_WUX,
DUMP_AS_WUD,
@ -109,5 +108,4 @@ public:
int32_t writtenSectors{};
void *emptySector = nullptr;
};

View File

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

View File

@ -1,12 +1,12 @@
#pragma once
#include <cstdio>
#include <string>
#include <cstring>
#include <fcntl.h>
#include <string>
#include <unistd.h>
#include <wut_types.h>
#include <utils/logger.h>
#include <wut_types.h>
class CFile {
public:

View File

@ -1,11 +1,11 @@
#include <malloc.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include "FSUtils.h"
#include "CFile.hpp"
#include "utils/logger.h"
#include <fcntl.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
int32_t FSUtils::LoadFileToMem(const char *filepath, uint8_t **inbuffer, uint32_t *size) {
//! always initialze input
@ -171,4 +171,3 @@ int32_t FSUtils::saveBufferToFile(const char *path, void *buffer, uint32_t size)
file.close();
return written;
}

View File

@ -1,7 +1,7 @@
#pragma once
#include <wut_types.h>
#include <string>
#include <wut_types.h>
class FSUtils {
public:

View File

@ -14,11 +14,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <utils/logger.h>
#include "WUDFileWriter.h"
#include <utils/logger.h>
WUDFileWriter::WUDFileWriter(const char *path, int32_t cacheSize, int32_t pSectorSize, bool split) :
WriteOnlyFileWithCache(path, cacheSize, split),
WUDFileWriter::WUDFileWriter(const char *path, int32_t cacheSize, int32_t pSectorSize, bool split) : WriteOnlyFileWithCache(path, cacheSize, split),
sectorSize(pSectorSize) {
}
@ -31,5 +30,4 @@ int32_t WUDFileWriter::writeSector(const uint8_t *buffer, uint32_t numberOfSecto
}
void WUDFileWriter::finalize() {
}

View File

@ -25,6 +25,7 @@ public:
virtual int32_t writeSector(const uint8_t *buffer, uint32_t numberOfSectors);
virtual void finalize();
protected:
int32_t sectorSize;
};

View File

@ -14,12 +14,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <utils/logger.h>
#include "WUXFileWriter.h"
#include "WUDDumperState.h"
#include <utils/logger.h>
WUXFileWriter::WUXFileWriter(const char *path, int32_t cacheSize, int32_t sectorSize, bool split) :
WUDFileWriter(path, cacheSize, sectorSize, split) {
WUXFileWriter::WUXFileWriter(const char *path, int32_t cacheSize, int32_t sectorSize, bool split) : WUDFileWriter(path, cacheSize, sectorSize, split) {
wuxHeader_t wuxHeader = {0};
wuxHeader.magic0 = WUX_MAGIC_0;
wuxHeader.magic1 = WUX_MAGIC_1;
@ -111,5 +110,4 @@ void WUXFileWriter::finalize() {
WUDFileWriter::finalize();
writeSectorIndexTable();
WUXFileWriter::close();
}

View File

@ -16,8 +16,8 @@
****************************************************************************/
#pragma once
#include "utils/utils.h"
#include "WUDFileWriter.h"
#include "utils/utils.h"
#include <map>
typedef struct {

View File

@ -14,11 +14,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <malloc.h>
#include <coreinit/memory.h>
#include <utils/logger.h>
#include <utils/StringTools.h>
#include "WriteOnlyFileWithCache.h"
#include <coreinit/memory.h>
#include <malloc.h>
#include <utils/StringTools.h>
#include <utils/logger.h>
#define SPLIT_SIZE (0x80000000)

View File

@ -1,5 +1,5 @@
#pragma once
#include "Input.h"
class CombinedInput : public Input {
public:
void combine(const Input &b) {

View File

@ -1,7 +1,7 @@
#pragma once
#include <cstring>
#include <cstdint>
#include <cstring>
class Input {
public:
@ -57,5 +57,4 @@ public:
PadData data{};
PadData lastData{};
};

View File

@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <vpad/input.h>
#include "Input.h"
#include <vpad/input.h>
class VPadInput : public Input {
public:

View File

@ -16,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "Input.h"
#include <padscore/kpad.h>
#include <padscore/wpad.h>
#include "Input.h"
class WPADInput : public Input {
public:

View File

@ -1,21 +1,21 @@
#include <whb/proc.h>
#include <whb/log.h>
#include <whb/log_udp.h>
#include <whb/proc.h>
#include <thread>
#include <iosuhax.h>
#include <ntfs.h>
#include <coreinit/debug.h>
#include <coreinit/energysaver.h>
#include <padscore/kpad.h>
#include <input/WPADInput.h>
#include <input/CombinedInput.h>
#include <input/WPADInput.h>
#include <iosuhax.h>
#include <ntfs.h>
#include <padscore/kpad.h>
#include "utils/logger.h"
#include "utils/WiiUScreen.h"
#include "input/VPADInput.h"
#include "MainApplicationState.h"
#include "input/VPADInput.h"
#include "utils/WiiUScreen.h"
#include "utils/logger.h"
void initIOSUHax();
@ -84,8 +84,7 @@ void main_loop() {
WPAD_CHAN_0,
WPAD_CHAN_1,
WPAD_CHAN_2,
WPAD_CHAN_3
};
WPAD_CHAN_3};
if (gFSAfd < 0 || !sIosuhaxMount) {
// state.setError(MainApplicationState::eErrorState::ERROR_IOSUHAX_FAILED);
@ -98,8 +97,8 @@ void main_loop() {
if (vpadInput.update(1280, 720)) {
baseInput.combine(vpadInput);
}
for (auto &wpadInput: wpadInputs) {
if(wpadInput.update(1280, 720)){
for (auto &wpadInput : wpadInputs) {
if (wpadInput.update(1280, 720)) {
baseInput.combine(wpadInput);
}
}

View File

@ -34,7 +34,7 @@ std::optional<std::shared_ptr<NodeEntry>> FSTUtils::getFSTEntryByFullPath(const
if (!pathOpt.has_value()) {
return {};
}
for (auto &child: pathOpt.value()->getChildren()) {
for (auto &child : pathOpt.value()->getChildren()) {
if (child->getFullPath() == fullPath) {
return child;
}
@ -48,7 +48,7 @@ std::optional<std::shared_ptr<DirectoryEntry>> FSTUtils::getFileEntryDir(const s
if (!string.ends_with("/")) {
string += "/";
}
for (auto &curChild: curEntry->getDirChildren()) {
for (auto &curChild : curEntry->getDirChildren()) {
std::string compareTo = curChild->getFullPath();
if (!compareTo.ends_with("/")) {
compareTo += "/";
@ -64,7 +64,7 @@ std::optional<std::shared_ptr<DirectoryEntry>> FSTUtils::getFileEntryDir(const s
}
std::optional<std::shared_ptr<SectionEntry>> FSTUtils::getSectionEntryForIndex(const std::shared_ptr<FST> &pFst, uint16_t index) {
for (const auto &entry: pFst->sectionEntries->getSections()) {
for (const auto &entry : pFst->sectionEntries->getSections()) {
if (entry->sectionNumber == index) {
return entry;
}

View File

@ -16,10 +16,10 @@
****************************************************************************/
#pragma once
#include <string>
#include <WUD/entities/FST/nodeentry/NodeEntry.h>
#include <WUD/entities/FST/nodeentry/DirectoryEntry.h>
#include <WUD/entities/FST/FST.h>
#include <WUD/entities/FST/nodeentry/DirectoryEntry.h>
#include <WUD/entities/FST/nodeentry/NodeEntry.h>
#include <string>
class FSTUtils {
public:
@ -29,4 +29,3 @@ public:
static std::optional<std::shared_ptr<SectionEntry>> getSectionEntryForIndex(const std::shared_ptr<FST> &pFst, uint16_t index);
};

View File

@ -14,8 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#include <coreinit/screen.h>
#include "ScreenUtils.h"
#include <coreinit/screen.h>
void ScreenUtils::printTextOnScreen(ConsoleScreenID screen, int x, int y, const char *msg) {
if (!msg) {

View File

@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#pragma once
#include <stdint.h>
//! Defines the ID of a display usable with OSScreen.
typedef enum ConsoleScreenID {

View File

@ -23,17 +23,16 @@
*
* for WiiXplorer 2010
***************************************************************************/
#include <vector>
#include <string>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <strings.h>
#include <wut_types.h>
#include <stdio.h>
#include "StringTools.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <strings.h>
#include <vector>
#include <wchar.h>
#include <wut_types.h>
BOOL StringTools::EndsWith(const std::string &a, const std::string &b) {
@ -214,8 +213,7 @@ bool StringTools::findStringIC(const std::string &strHaystack, const std::string
auto it = std::search(
strHaystack.begin(), strHaystack.end(),
strNeedle.begin(), strNeedle.end(),
[](char ch1, char ch2) { return std::toupper(ch1) == std::toupper(ch2); }
);
[](char ch1, char ch2) { return std::toupper(ch1) == std::toupper(ch2); });
return (it != strHaystack.end());
}

View File

@ -25,11 +25,11 @@
***************************************************************************/
#pragma once
#include <vector>
#include <string>
#include <wut_types.h>
#include <algorithm>
#include <cctype>
#include <string>
#include <vector>
#include <wut_types.h>
class StringTools {
public:

View File

@ -1,3 +1,4 @@
// clang-format off
/*
*
* TinySHA1 - a header only implementation of the SHA1 algorithm in C++. Based

View File

@ -3,23 +3,24 @@
#include <whb/log.h>
#include <whb/log_console.h>
#include <coreinit/memheap.h>
#include "utils/logger.h"
#include <coreinit/cache.h>
#include <coreinit/memfrmheap.h>
#include <coreinit/memheap.h>
#include <coreinit/memory.h>
#include <coreinit/screen.h>
#include <proc_ui/procui.h>
#include <cstring>
#include "utils/logger.h"
#include <proc_ui/procui.h>
#define NUM_LINES (16)
#define LINE_LENGTH (128)
#define CONSOLE_FRAME_HEAP_TAG (0x000DECAF)
#define PRINTF_BUFFER_LENGTH 2048
#define DEBUG_CONSOLE_LOG(FMT, ARGS...)do { \
DEBUG_FUNCTION_LINE(FMT, ## ARGS); \
WiiUScreen::drawLinef(FMT, ## ARGS); \
#define DEBUG_CONSOLE_LOG(FMT, ARGS...) \
do { \
DEBUG_FUNCTION_LINE(FMT, ##ARGS); \
WiiUScreen::drawLinef(FMT, ##ARGS); \
} while (0)

View File

@ -16,13 +16,12 @@
****************************************************************************/
#pragma once
#include <cstdint>
#include "BlockSize.h"
#include <cstdint>
class AddressInBlocks {
public:
explicit AddressInBlocks(const BlockSize &pBlockSize, uint32_t pValue) : blockSize(pBlockSize), value(pValue) {
}
AddressInBlocks() = default;

View File

@ -38,4 +38,4 @@ namespace std {
return lhs.getAddressInBytes() < rhs.getAddressInBytes();
}
};
}
} // namespace std

View File

@ -16,8 +16,8 @@
****************************************************************************/
#pragma once
#include "VolumeBlockSize.h"
#include "AddressInBlocks.h"
#include "VolumeBlockSize.h"
class AddressInVolumeBlocks : public AddressInBlocks {

View File

@ -16,8 +16,8 @@
****************************************************************************/
#pragma once
#include "utils/logger.h"
#include "BlockSize.h"
#include "utils/logger.h"
class DiscBlockSize : public BlockSize {
@ -25,6 +25,5 @@ public:
DiscBlockSize() = default;
explicit DiscBlockSize(uint32_t blockSize) : BlockSize(blockSize) {
}
};

View File

@ -16,8 +16,8 @@
****************************************************************************/
#pragma once
#include <cstdint>
#include "BlockSize.h"
#include <cstdint>
class SectionBlockSize : public BlockSize {

View File

@ -16,9 +16,9 @@
****************************************************************************/
#pragma once
#include "BlockSize.h"
#include <iostream>
#include <type_traits>
#include "BlockSize.h"
class SizeInBlocks {
public:

View File

@ -1,7 +1,7 @@
#pragma once
#include "VolumeBlockSize.h"
#include "SizeInBlocks.h"
#include "VolumeBlockSize.h"
class SizeInVolumeBlocks : public SizeInBlocks {
@ -9,6 +9,5 @@ public:
SizeInVolumeBlocks() = default;
SizeInVolumeBlocks(const VolumeBlockSize &blockSize, uint32_t value) : SizeInBlocks(blockSize, value) {
}
};

View File

@ -16,8 +16,8 @@
****************************************************************************/
#pragma once
#include <cstdint>
#include "BlockSize.h"
#include <cstdint>
class VolumeBlockSize : public BlockSize {

Some files were not shown because too many files have changed in this diff Show More