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 - main
jobs: jobs:
clang-format:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: clang-format
run: |
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source
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: Checkout submodules using a PAT - name: Checkout submodules using a PAT

View File

@ -3,8 +3,16 @@ name: CI-PR
on: [pull_request] on: [pull_request]
jobs: jobs:
clang-format:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: clang-format
run: |
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source
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: Checkout submodules using a PAT - 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) # Build docker image (only needed once)
docker build . -t WUDD-builder docker build . -t wudd-builder
# make # make
docker run -it --rm -v ${PWD}:/project WUDD-builder make docker run -it --rm -v ${PWD}:/project wudd-builder make
# make clean # 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 #pragma once
#include "input/Input.h"
#include <utils/WiiUScreen.h> #include "utils/ScreenUtils.h"
#include <utils/ScreenUtils.h> #include "utils/WiiUScreen.h"
#include <stdint.h>
class ApplicationState { class ApplicationState {
public: public:

View File

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

View File

@ -16,17 +16,18 @@
****************************************************************************/ ****************************************************************************/
#pragma once #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 <map>
#include <memory>
#include <string> #include <string>
#include <vector> #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 { class GMPartitionsDumperState : public ApplicationState {
public: public:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,9 +16,9 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include <cstdint>
#include <WUD/entities/TMD/Content.h>
#include <WUD/entities/FST/FST.h> #include <WUD/entities/FST/FST.h>
#include <WUD/entities/TMD/Content.h>
#include <cstdint>
class NUSDataProvider { class NUSDataProvider {
@ -36,6 +36,5 @@ public:
virtual bool getRawCert(std::vector<uint8_t> &out_data) = 0; virtual bool getRawCert(std::vector<uint8_t> &out_data) = 0;
virtual void setFST(const std::shared_ptr<FST> &fst) { 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) { void NUSDataProviderWUD::setFST(const std::shared_ptr<FST> &pFST) {
// We need to set the correct blocksizes // We need to set the correct blocksizes
auto blockSize = gamePartition->getVolumes().begin()->second->blockSize; 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->address = AddressInVolumeBlocks(blockSize, e->address.value);
e->size = SizeInVolumeBlocks(blockSize, e->size.value); e->size = SizeInVolumeBlocks(blockSize, e->size.value);
} }

View File

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

View File

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

View File

@ -16,15 +16,15 @@
****************************************************************************/ ****************************************************************************/
#pragma once #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 "DefaultNUSDataProcessor.h"
#include "DiscReaderDiscDrive.h" #include "DiscReaderDiscDrive.h"
#include "NUSDataProcessor.h"
#include "NUSDataProviderWUD.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 { class NUSTitle {
@ -52,5 +52,4 @@ private:
std::shared_ptr<NUSDecryption> pDecryption, std::shared_ptr<NUSDecryption> pDecryption,
std::shared_ptr<Ticket> pTicket, std::shared_ptr<Ticket> pTicket,
std::shared_ptr<FST> pFST); std::shared_ptr<FST> pFST);
}; };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,11 +27,11 @@ WiiUGMPartition::WiiUGMPartition(std::shared_ptr<WiiUPartition> partition,
basePartition(std::move(partition)) { basePartition(std::move(partition)) {
} }
std::string WiiUGMPartition::getVolumeId() const &{ std::string WiiUGMPartition::getVolumeId() const & {
return basePartition->getVolumeId(); 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(); return basePartition->getVolumes();
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -16,13 +16,13 @@
****************************************************************************/ ****************************************************************************/
#pragma once #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 "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_TMD_FILENAME "title.tmd"
#define WUD_TICKET_FILENAME "title.tik" #define WUD_TICKET_FILENAME "title.tik"

View File

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

View File

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

View File

@ -16,16 +16,17 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include <utility> #include "H3HashArray.h"
#include <vector>
#include <cstdint>
#include <WUD/DiscReader.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/AddressInVolumeBlocks.h>
#include <utils/blocksize/SizeInVolumeBlocks.h> #include <utils/blocksize/SizeInVolumeBlocks.h>
#include <optional> #include <utils/blocksize/VolumeBlockSize.h>
#include <utils/utils.h> #include <utils/utils.h>
#include "H3HashArray.h" #include <vector>
class VolumeHeader { class VolumeHeader {
@ -63,5 +64,4 @@ private:
std::vector<std::shared_ptr<H3HashArray>> pH3HashArrayList, std::vector<std::shared_ptr<H3HashArray>> pH3HashArrayList,
uint32_t pH3HashArrayListSize, uint32_t pH3HashArrayListSize,
uint32_t pNumberOfH3HashArray); 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, FST::FST(std::unique_ptr<FSTHeader> pHeader,
std::shared_ptr<SectionEntries> pSectionEntries, std::shared_ptr<SectionEntries> pSectionEntries,
std::shared_ptr<StringTable> pStringTable, std::shared_ptr<StringTable> pStringTable,
std::unique_ptr<NodeEntries> pNodeEntries) : std::unique_ptr<NodeEntries> pNodeEntries) : sectionEntries(std::move(pSectionEntries)),
sectionEntries(std::move(pSectionEntries)),
stringTable(std::move(pStringTable)), stringTable(std::move(pStringTable)),
nodeEntries(std::move(pNodeEntries)), nodeEntries(std::move(pNodeEntries)),
header(std::move(pHeader)) { header(std::move(pHeader)) {
} }

View File

@ -16,15 +16,15 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include <optional>
#include <memory>
#include <cstdint>
#include <utility>
#include <WUD/entities/FST/header/FSTHeader.h> #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/NodeEntries.h>
#include <WUD/entities/FST/nodeentry/RootEntry.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 { class FST {
public: 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); 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; std::shared_ptr<SectionEntries> sectionEntries;
private: private:
FST(std::unique_ptr<FSTHeader> pHeader, FST(std::unique_ptr<FSTHeader> pHeader,
std::shared_ptr<SectionEntries> pSectionEntries, std::shared_ptr<SectionEntries> pSectionEntries,
std::shared_ptr<StringTable> pStringTable, std::shared_ptr<StringTable> pStringTable,
std::unique_ptr<NodeEntries> pNodeEntries std::unique_ptr<NodeEntries> pNodeEntries);
);
std::shared_ptr<StringTable> stringTable; std::shared_ptr<StringTable> stringTable;
std::unique_ptr<NodeEntries> nodeEntries; std::unique_ptr<NodeEntries> nodeEntries;

View File

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

View File

@ -16,9 +16,9 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include <optional>
#include <memory>
#include <cstdint> #include <cstdint>
#include <memory>
#include <optional>
#include <utils/blocksize/SectionBlockSize.h> #include <utils/blocksize/SectionBlockSize.h>
class FSTHeader { class FSTHeader {
@ -35,5 +35,4 @@ public:
private: private:
FSTHeader(uint8_t pFSTVersion, SectionBlockSize pBlockSize, uint32_t pNumberOfSections, uint8_t pHashDisabled); 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 * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <coreinit/debug.h>
#include "DirectoryEntry.h" #include "DirectoryEntry.h"
#include <coreinit/debug.h>
std::optional<std::shared_ptr<DirectoryEntry>> 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, 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>> DirectoryEntry::getDirChildren() const {
std::vector<std::shared_ptr<DirectoryEntry>> res; std::vector<std::shared_ptr<DirectoryEntry>> res;
for (auto &cur: children) { for (auto &cur : children) {
if (cur->isDirectory()) { if (cur->isDirectory()) {
res.push_back(std::dynamic_pointer_cast<DirectoryEntry>(cur)); 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>> DirectoryEntry::getFileChildren() const {
std::vector<std::shared_ptr<FileEntry>> res; std::vector<std::shared_ptr<FileEntry>> res;
for (auto &cur: children) { for (auto &cur : children) {
if (cur->isFile()) { if (cur->isFile()) {
res.push_back(std::dynamic_pointer_cast<FileEntry>(cur)); 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() { void DirectoryEntry::printPathRecursive() {
DEBUG_FUNCTION_LINE("%s", getFullPath().c_str()); DEBUG_FUNCTION_LINE("%s", getFullPath().c_str());
for (auto &child: children) { for (auto &child : children) {
child->printPathRecursive(); child->printPathRecursive();
} }
} }
@ -77,8 +77,7 @@ DirectoryEntry::DirectoryEntry(const NodeEntryParam &param,
const std::shared_ptr<StringEntry> &pStringEntry, const std::shared_ptr<StringEntry> &pStringEntry,
const std::shared_ptr<SectionEntry> &pSectionEntry, const std::shared_ptr<SectionEntry> &pSectionEntry,
uint32_t pParentEntryNumber, uint32_t pParentEntryNumber,
uint32_t pLastEntryNumber) : uint32_t pLastEntryNumber) : NodeEntry(param.permission,
NodeEntry(param.permission,
pStringEntry, pStringEntry,
pSectionEntry, pSectionEntry,
param.parent, param.parent,
@ -88,8 +87,7 @@ DirectoryEntry::DirectoryEntry(const NodeEntryParam &param,
lastEntryNumber(pLastEntryNumber) { lastEntryNumber(pLastEntryNumber) {
} }
DirectoryEntry::DirectoryEntry(const std::shared_ptr<DirectoryEntry> &input) : DirectoryEntry::DirectoryEntry(const std::shared_ptr<DirectoryEntry> &input) : NodeEntry(input->permission,
NodeEntry(input->permission,
input->nameString, input->nameString,
input->sectionEntry, input->sectionEntry,
input->parent, input->parent,
@ -97,5 +95,4 @@ DirectoryEntry::DirectoryEntry(const std::shared_ptr<DirectoryEntry> &input) :
input->entryNumber), input->entryNumber),
parentEntryNumber(input->parentEntryNumber), parentEntryNumber(input->parentEntryNumber),
lastEntryNumber(input->lastEntryNumber) { lastEntryNumber(input->lastEntryNumber) {
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,13 +16,13 @@
****************************************************************************/ ****************************************************************************/
#pragma once #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 <cstdint>
#include <utils/blocksize/SectionBlockSize.h> #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 <utils/logger.h>
#include "NodeEntryParam.h"
#define ENTRY_TYPE_File 0 #define ENTRY_TYPE_File 0
#define ENTRY_TYPE_Directory 1 #define ENTRY_TYPE_Directory 1

View File

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

View File

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

View File

@ -16,11 +16,11 @@
****************************************************************************/ ****************************************************************************/
#pragma once #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 "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 { class RootEntry : public DirectoryEntry {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,17 +16,16 @@
****************************************************************************/ ****************************************************************************/
#pragma once #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 "WiiUDiscId.h"
#include "WiiUManufactorDiscId.h"
#include <WUD/DiscReader.h>
#include <WUD/DiscReaderDiscDrive.h>
#include <WUD/content/WiiUContentsInformation.h>
#include <cstdint>
#include <memory>
class WiiUDiscHeader { class WiiUDiscHeader {
public: public:
static std::optional<std::unique_ptr<WiiUDiscHeader>> make_unique(const std::shared_ptr<DiscReader> &discReader); static std::optional<std::unique_ptr<WiiUDiscHeader>> make_unique(const std::shared_ptr<DiscReader> &discReader);
std::unique_ptr<WiiUManufactorDiscId> manufactorDiscId; std::unique_ptr<WiiUManufactorDiscId> manufactorDiscId;
@ -39,6 +38,5 @@ private:
explicit WiiUDiscHeader( explicit WiiUDiscHeader(
std::unique_ptr<WiiUManufactorDiscId> pManufactorDiscId, std::unique_ptr<WiiUManufactorDiscId> pManufactorDiscId,
std::unique_ptr<WiiUDiscId> pDiscId, 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include "WiiUDiscId.h" #include "WiiUDiscId.h"
#include <memory>
#include <coreinit/debug.h> #include <coreinit/debug.h>
#include <memory>
#include <utils/logger.h> #include <utils/logger.h>
std::optional<std::unique_ptr<WiiUDiscId>> WiiUDiscId::make_unique(const std::shared_ptr<DiscReader> &discReader, uint32_t offset) { 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)); return std::unique_ptr<WiiUDiscId>(new WiiUDiscId(minorVersion, majorVersion, footprint));
} }
WiiUDiscId::WiiUDiscId(uint8_t pMinorVersion, uint8_t pMajorVersion, const std::string &pFootprint) : WiiUDiscId::WiiUDiscId(uint8_t pMinorVersion, uint8_t pMajorVersion, const std::string &pFootprint) : minorVersion(pMinorVersion),
minorVersion(pMinorVersion),
majorVersion(pMajorVersion), majorVersion(pMajorVersion),
footprint(pFootprint) { footprint(pFootprint) {
} }

View File

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

View File

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

View File

@ -14,15 +14,15 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <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 "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) WUDDumperState::WUDDumperState(WUDDumperState::eDumpTargetFormat pTargetFormat, eDumpTarget pTargetDevice)
: targetFormat(pTargetFormat), targetDevice(pTargetDevice) { : targetFormat(pTargetFormat), targetDevice(pTargetDevice) {

View File

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

View File

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

View File

@ -1,12 +1,12 @@
#pragma once #pragma once
#include <cstdio> #include <cstdio>
#include <string>
#include <cstring> #include <cstring>
#include <fcntl.h> #include <fcntl.h>
#include <string>
#include <unistd.h> #include <unistd.h>
#include <wut_types.h>
#include <utils/logger.h> #include <utils/logger.h>
#include <wut_types.h>
class CFile { class CFile {
public: 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 "FSUtils.h"
#include "CFile.hpp" #include "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
@ -171,4 +171,3 @@ int32_t FSUtils::saveBufferToFile(const char *path, void *buffer, uint32_t size)
file.close(); file.close();
return written; return written;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,10 +16,10 @@
****************************************************************************/ ****************************************************************************/
#pragma once #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/FST.h>
#include <WUD/entities/FST/nodeentry/DirectoryEntry.h>
#include <WUD/entities/FST/nodeentry/NodeEntry.h>
#include <string>
class FSTUtils { class FSTUtils {
public: public:
@ -29,4 +29,3 @@ public:
static std::optional<std::shared_ptr<SectionEntry>> getSectionEntryForIndex(const std::shared_ptr<FST> &pFst, uint16_t index); 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 * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include <coreinit/screen.h>
#include "ScreenUtils.h" #include "ScreenUtils.h"
#include <coreinit/screen.h>
void ScreenUtils::printTextOnScreen(ConsoleScreenID screen, int x, int y, const char *msg) { void ScreenUtils::printTextOnScreen(ConsoleScreenID screen, int x, int y, const char *msg) {
if (!msg) { if (!msg) {

View File

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

View File

@ -23,17 +23,16 @@
* *
* for WiiXplorer 2010 * 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 "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) { 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( auto it = std::search(
strHaystack.begin(), strHaystack.end(), strHaystack.begin(), strHaystack.end(),
strNeedle.begin(), strNeedle.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()); return (it != strHaystack.end());
} }

View File

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

View File

@ -1,3 +1,4 @@
// clang-format off
/* /*
* *
* TinySHA1 - a header only implementation of the SHA1 algorithm in C++. Based * 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.h>
#include <whb/log_console.h> #include <whb/log_console.h>
#include <coreinit/memheap.h> #include "utils/logger.h"
#include <coreinit/cache.h> #include <coreinit/cache.h>
#include <coreinit/memfrmheap.h> #include <coreinit/memfrmheap.h>
#include <coreinit/memheap.h>
#include <coreinit/memory.h> #include <coreinit/memory.h>
#include <coreinit/screen.h> #include <coreinit/screen.h>
#include <proc_ui/procui.h>
#include <cstring> #include <cstring>
#include "utils/logger.h" #include <proc_ui/procui.h>
#define NUM_LINES (16) #define NUM_LINES (16)
#define LINE_LENGTH (128) #define LINE_LENGTH (128)
#define CONSOLE_FRAME_HEAP_TAG (0x000DECAF) #define CONSOLE_FRAME_HEAP_TAG (0x000DECAF)
#define PRINTF_BUFFER_LENGTH 2048 #define PRINTF_BUFFER_LENGTH 2048
#define DEBUG_CONSOLE_LOG(FMT, ARGS...)do { \ #define DEBUG_CONSOLE_LOG(FMT, ARGS...) \
DEBUG_FUNCTION_LINE(FMT, ## ARGS); \ do { \
WiiUScreen::drawLinef(FMT, ## ARGS); \ DEBUG_FUNCTION_LINE(FMT, ##ARGS); \
WiiUScreen::drawLinef(FMT, ##ARGS); \
} while (0) } while (0)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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