Compare commits

..

No commits in common. "main" and "wudd-20220801-131259" have entirely different histories.

16 changed files with 75 additions and 85 deletions

View File

@ -1,10 +0,0 @@
version: 2
updates:
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

View File

@ -7,17 +7,17 @@ on:
jobs: jobs:
clang-format: clang-format:
runs-on: ubuntu-22.04 runs-on: ubuntu-18.04
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: clang-format - name: clang-format
run: | run: |
docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./source docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source
build-binary: build-binary:
runs-on: ubuntu-22.04 runs-on: ubuntu-18.04
needs: clang-format needs: clang-format
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: create version.h - name: create version.h
run: | run: |
git_hash=$(git rev-parse --short "$GITHUB_SHA") git_hash=$(git rev-parse --short "$GITHUB_SHA")
@ -33,9 +33,13 @@ jobs:
with: with:
name: wuhb-binary name: wuhb-binary
path: "*.wuhb" path: "*.wuhb"
- uses: actions/upload-artifact@master
with:
name: rpx-binary
path: "*.rpx"
deploy-binary: deploy-binary:
needs: build-binary needs: build-binary
runs-on: ubuntu-22.04 runs-on: ubuntu-18.04
steps: steps:
- name: Get environment variables - name: Get environment variables
id: get_repository_name id: get_repository_name
@ -46,15 +50,32 @@ jobs:
with: with:
name: wuhb-binary name: wuhb-binary
path: wiiu/apps/wudd path: wiiu/apps/wudd
- uses: actions/download-artifact@master
with:
name: rpx-binary
path: wiiu/apps/wudd
- name: zip artifact - name: zip artifact
run: zip -r ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip wiiu run: zip -r ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip wiiu
- name: Create Release - name: Create Release
uses: "softprops/action-gh-release@v1" id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag_name: ${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }} tag_name: ${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }}
release_name: Nightly-${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }}
draft: false draft: false
prerelease: true prerelease: true
generate_release_notes: true body: |
name: Nightly-${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }} Not a stable release:
files: | ${{ github.event.head_commit.message }}
./${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip - name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip
asset_name: ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip
asset_content_type: application/zip

View File

@ -4,17 +4,17 @@ on: [pull_request]
jobs: jobs:
clang-format: clang-format:
runs-on: ubuntu-22.04 runs-on: ubuntu-18.04
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: clang-format - name: clang-format
run: | run: |
docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./source docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source
check-build-with-logging: check-build-with-logging:
runs-on: ubuntu-22.04 runs-on: ubuntu-18.04
needs: clang-format needs: clang-format
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: build binary with logging - name: build binary with logging
run: | run: |
docker build . -t builder docker build . -t builder
@ -22,10 +22,10 @@ jobs:
docker run --rm -v ${PWD}:/project builder make clean docker run --rm -v ${PWD}:/project builder make clean
docker run --rm -v ${PWD}:/project builder make DEBUG=1 docker run --rm -v ${PWD}:/project builder make DEBUG=1
build-binary: build-binary:
runs-on: ubuntu-22.04 runs-on: ubuntu-18.04
needs: clang-format needs: clang-format
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: create version.h - name: create version.h
run: | run: |
git_hash=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}") git_hash=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}")
@ -40,4 +40,4 @@ jobs:
- uses: actions/upload-artifact@master - uses: actions/upload-artifact@master
with: with:
name: binary name: binary
path: "*.wuhb" path: "*.rpx"

View File

@ -1,6 +1,6 @@
FROM ghcr.io/wiiu-env/devkitppc:20230621 FROM wiiuenv/devkitppc:20220801
COPY --from=ghcr.io/wiiu-env/libntfs:20220726 /artifacts $DEVKITPRO COPY --from=wiiuenv/libntfs:20220726 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libmocha:20220919 /artifacts $DEVKITPRO COPY --from=wiiuenv/libmocha:20220726 /artifacts $DEVKITPRO
WORKDIR project WORKDIR project

View File

@ -52,7 +52,6 @@ SOURCES := source \
DATA := data DATA := data
INCLUDES := source INCLUDES := source
ICON := data/icon.png
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# options for code generation # options for code generation
@ -165,7 +164,7 @@ endif
all: $(BUILD) all: $(BUILD)
$(BUILD): $(BUILD):
@$(shell [ ! -d $(BUILD) ] && mkdir -p $(BUILD)) @[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------

View File

@ -9,8 +9,6 @@ Features:
Files will be dumped to `/wudump/[DISC-ID]/`. The disc id of a game can be found on the disc (e.g. WUP-P-ARDP for the EUR version of Super Mario 3D World). If WUDD fails to determine the disc id, "DISC" with a timestamp will be used instead. Files will be dumped to `/wudump/[DISC-ID]/`. The disc id of a game can be found on the disc (e.g. WUP-P-ARDP for the EUR version of Super Mario 3D World). If WUDD fails to determine the disc id, "DISC" with a timestamp will be used instead.
If you want to create a partial dump (skipped sectors represented by 00 bytes) for discs with unreadable sectors, you can avoid the need to manually choose the skip sectors option on each error, by pressing Y at the error message to activate auto skip mode
## How to merge splitted files ## How to merge splitted files
When you dump a .wux or .wud to the SD card it gets splitted into 2 GiB parts (FAT32 limitation). To merge them you can use the `copy` cmd tool. When you dump a .wux or .wud to the SD card it gets splitted into 2 GiB parts (FAT32 limitation). To merge them you can use the `copy` cmd tool.
@ -53,4 +51,4 @@ docker run -it --rm -v ${PWD}:/project wudd-builder make clean
## Format the code via docker ## Format the code via docker
`docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./source -i` `docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source -i`

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

View File

@ -56,7 +56,7 @@ public:
} }
virtual void printHeader() { virtual void printHeader() {
WiiUScreen::drawLine("WUDD - Wii U Disc Dumper v1.2.2" VERSION_EXTRA); WiiUScreen::drawLine("WUDD - Wii U Disc Dumper v1.1.0" VERSION_EXTRA);
WiiUScreen::drawLine("=================="); WiiUScreen::drawLine("==================");
WiiUScreen::drawLine(""); WiiUScreen::drawLine("");
} }
@ -77,4 +77,4 @@ public:
int selectedOptionY = 0; int selectedOptionY = 0;
int selectedOptionX = 0; int selectedOptionX = 0;
}; };

View File

@ -36,10 +36,6 @@ GMPartitionsDumperState::GMPartitionsDumperState(eDumpTarget pTargetDevice) : ta
} }
GMPartitionsDumperState::~GMPartitionsDumperState() { GMPartitionsDumperState::~GMPartitionsDumperState() {
if (this->oddFd != -1) {
FSAEx_RawCloseEx(gFSAClientHandle, this->oddFd);
this->oddFd = -1;
}
free(this->sectorBuf); free(this->sectorBuf);
this->sectorBuf = nullptr; this->sectorBuf = nullptr;
free(this->readBuffer); free(this->readBuffer);
@ -182,7 +178,7 @@ ApplicationState::eSubState GMPartitionsDumperState::update(Input *input) {
} }
if (this->state == STATE_OPEN_ODD1) { if (this->state == STATE_OPEN_ODD1) {
auto ret = FSAEx_RawOpenEx(gFSAClientHandle, "/dev/odd01", &(this->oddFd)); auto ret = FSAEx_RawOpen(__wut_devoptab_fs_client, "/dev/odd01", &(this->oddFd));
if (ret >= 0) { if (ret >= 0) {
if (this->sectorBuf == nullptr) { if (this->sectorBuf == nullptr) {
this->sectorBuf = (void *) memalign(0x100, this->sectorBufSize); this->sectorBuf = (void *) memalign(0x100, this->sectorBufSize);
@ -200,13 +196,13 @@ ApplicationState::eSubState GMPartitionsDumperState::update(Input *input) {
return ApplicationState::SUBSTATE_RETURN; return ApplicationState::SUBSTATE_RETURN;
} }
} else if (this->state == STATE_READ_DISC_INFO) { } else if (this->state == STATE_READ_DISC_INFO) {
if (FSAEx_RawReadEx(gFSAClientHandle, this->sectorBuf, READ_SECTOR_SIZE, 1, 0, this->oddFd) >= 0) { if (FSAEx_RawRead(__wut_devoptab_fs_client, this->sectorBuf, READ_SECTOR_SIZE, 1, 0, this->oddFd) >= 0) {
this->discId[10] = '\0'; this->discId[10] = '\0';
memcpy(this->discId.data(), sectorBuf, 10); memcpy(this->discId.data(), sectorBuf, 10);
this->state = STATE_READ_DISC_INFO_DONE; this->state = STATE_READ_DISC_INFO_DONE;
return ApplicationState::SUBSTATE_RUNNING; return ApplicationState::SUBSTATE_RUNNING;
} }
FSAEx_RawCloseEx(gFSAClientHandle, this->oddFd); FSAEx_RawClose(__wut_devoptab_fs_client, this->oddFd);
this->oddFd = -1; this->oddFd = -1;
this->setError(ERROR_READ_FIRST_SECTOR); this->setError(ERROR_READ_FIRST_SECTOR);

View File

@ -81,7 +81,7 @@ bool DiscReader::readDecrypted(uint8_t *out_buffer, uint64_t clusterOffset, uint
uint32_t blockNumber = (totalOffset / BLOCK_SIZE); uint32_t blockNumber = (totalOffset / BLOCK_SIZE);
uint32_t blockOffset = (totalOffset % BLOCK_SIZE); uint32_t blockOffset = (totalOffset % BLOCK_SIZE);
readOffset = ((uint64_t) blockNumber * BLOCK_SIZE); readOffset = (blockNumber * BLOCK_SIZE);
if (!useFixedIV) { if (!useFixedIV) {
memset(usedIV, 0, 16); memset(usedIV, 0, 16);
uint64_t ivTemp = usedFileOffset >> 16; uint64_t ivTemp = usedFileOffset >> 16;

View File

@ -31,13 +31,13 @@ DiscReaderDiscDrive::DiscReaderDiscDrive() : DiscReader() {
return; return;
} }
auto ret = FSAEx_RawOpenEx(gFSAClientHandle, "/dev/odd01", &device_handle); auto ret = FSAEx_RawOpen(__wut_devoptab_fs_client, "/dev/odd01", &device_handle);
if (ret < 0) { if (ret < 0) {
free(sector_buf); free(sector_buf);
return; return;
} }
auto res = FSAEx_RawReadEx(gFSAClientHandle, sector_buf, READ_SECTOR_SIZE, 1, 3, device_handle); auto res = FSAEx_RawRead(__wut_devoptab_fs_client, sector_buf, READ_SECTOR_SIZE, 1, 3, device_handle);
if (res >= 0) { if (res >= 0) {
if (((uint32_t *) sector_buf)[0] != WiiUDiscContentsHeader::MAGIC) { if (((uint32_t *) sector_buf)[0] != WiiUDiscContentsHeader::MAGIC) {
uint8_t iv[16]; uint8_t iv[16];
@ -75,7 +75,7 @@ DiscReaderDiscDrive::DiscReaderDiscDrive() : DiscReader() {
} }
bool DiscReaderDiscDrive::readEncryptedSector(uint8_t *buffer, uint32_t block_cnt, uint32_t block_offset) const { bool DiscReaderDiscDrive::readEncryptedSector(uint8_t *buffer, uint32_t block_cnt, uint32_t block_offset) const {
if (FSAEx_RawReadEx(gFSAClientHandle, buffer, READ_SECTOR_SIZE, block_cnt, block_offset, device_handle) < 0) { if (FSAEx_RawRead(__wut_devoptab_fs_client, buffer, READ_SECTOR_SIZE, block_cnt, block_offset, device_handle) < 0) {
return false; return false;
} }
return true; return true;
@ -87,7 +87,7 @@ bool DiscReaderDiscDrive::IsReady() {
DiscReaderDiscDrive::~DiscReaderDiscDrive() { DiscReaderDiscDrive::~DiscReaderDiscDrive() {
if (device_handle != -1) { if (device_handle != -1) {
FSAEx_RawCloseEx(gFSAClientHandle, device_handle); FSAEx_RawClose(__wut_devoptab_fs_client, device_handle);
device_handle = -1; device_handle = -1;
} }
} }
@ -102,7 +102,7 @@ bool DiscReaderDiscDrive::readEncrypted(uint8_t *buf, uint64_t offset, uint32_t
} }
uint32_t block_cnt = size >> 15; uint32_t block_cnt = size >> 15;
uint32_t offset_in_sectors = offset >> 15; uint32_t offset_in_sectors = offset >> 15;
if (FSAEx_RawReadEx(gFSAClientHandle, buf, 0x8000, block_cnt, offset_in_sectors, device_handle) < 0) { if (FSAEx_RawRead(__wut_devoptab_fs_client, buf, 0x8000, block_cnt, offset_in_sectors, device_handle) < 0) {
DEBUG_FUNCTION_LINE_ERR("Failed to read from Disc"); DEBUG_FUNCTION_LINE_ERR("Failed to read from Disc");
return false; return false;
} }

View File

@ -28,5 +28,5 @@ public:
~H3HashArray(); ~H3HashArray();
std::unique_ptr<uint8_t[]> data; std::unique_ptr<uint8_t[]> data;
uint32_t size; uint8_t size;
}; };

View File

@ -35,7 +35,7 @@ WUDDumperState::WUDDumperState(WUDDumperState::eDumpTargetFormat pTargetFormat,
WUDDumperState::~WUDDumperState() { WUDDumperState::~WUDDumperState() {
if (this->oddFd >= 0) { if (this->oddFd >= 0) {
FSAEx_RawCloseEx(gFSAClientHandle, oddFd); FSAEx_RawClose(__wut_devoptab_fs_client, oddFd);
} }
free(sectorBuf); free(sectorBuf);
free(emptySector); free(emptySector);
@ -51,7 +51,7 @@ ApplicationState::eSubState WUDDumperState::update(Input *input) {
} }
if (this->state == STATE_OPEN_ODD1) { if (this->state == STATE_OPEN_ODD1) {
if (this->currentSector > 0) { if (this->currentSector > 0) {
auto ret = FSAEx_RawOpenEx(gFSAClientHandle, "/dev/odd01", &(this->oddFd)); auto ret = FSAEx_RawOpen(__wut_devoptab_fs_client, "/dev/odd01", &(this->oddFd));
if (ret >= 0) { if (ret >= 0) {
// continue! // continue!
this->state = STATE_DUMP_DISC; this->state = STATE_DUMP_DISC;
@ -65,7 +65,7 @@ ApplicationState::eSubState WUDDumperState::update(Input *input) {
this->state = STATE_PLEASE_INSERT_DISC; this->state = STATE_PLEASE_INSERT_DISC;
return ApplicationState::SUBSTATE_RUNNING; return ApplicationState::SUBSTATE_RUNNING;
} }
auto ret = FSAEx_RawOpenEx(gFSAClientHandle, "/dev/odd01", &(this->oddFd)); auto ret = FSAEx_RawOpen(__wut_devoptab_fs_client, "/dev/odd01", &(this->oddFd));
if (ret >= 0) { if (ret >= 0) {
if (this->sectorBuf == nullptr) { if (this->sectorBuf == nullptr) {
this->sectorBuf = (void *) memalign(0x100, this->sectorBufSize); this->sectorBuf = (void *) memalign(0x100, this->sectorBufSize);
@ -83,7 +83,7 @@ ApplicationState::eSubState WUDDumperState::update(Input *input) {
return SUBSTATE_RETURN; return SUBSTATE_RETURN;
} }
} else if (this->state == STATE_READ_DISC_INFO) { } else if (this->state == STATE_READ_DISC_INFO) {
if (FSAEx_RawReadEx(gFSAClientHandle, this->sectorBuf, READ_SECTOR_SIZE, 1, 0, this->oddFd) >= 0) { if (FSAEx_RawRead(__wut_devoptab_fs_client, this->sectorBuf, READ_SECTOR_SIZE, 1, 0, this->oddFd) >= 0) {
this->discId[10] = '\0'; this->discId[10] = '\0';
memcpy(this->discId.data(), sectorBuf, 10); memcpy(this->discId.data(), sectorBuf, 10);
this->state = STATE_READ_DISC_INFO_DONE; this->state = STATE_READ_DISC_INFO_DONE;
@ -96,7 +96,7 @@ ApplicationState::eSubState WUDDumperState::update(Input *input) {
this->state = STATE_DUMP_DISC_KEY; this->state = STATE_DUMP_DISC_KEY;
} else if (this->state == STATE_DUMP_DISC_KEY) { } else if (this->state == STATE_DUMP_DISC_KEY) {
// Read the WiiUDiscContentsHeader to determine if we need disckey and if it's the correct one. // Read the WiiUDiscContentsHeader to determine if we need disckey and if it's the correct one.
auto res = FSAEx_RawReadEx(gFSAClientHandle, this->sectorBuf, READ_SECTOR_SIZE, 1, 3, this->oddFd); auto res = FSAEx_RawRead(__wut_devoptab_fs_client, this->sectorBuf, READ_SECTOR_SIZE, 1, 3, this->oddFd);
WUDDiscKey discKey; WUDDiscKey discKey;
bool hasDiscKey = false; bool hasDiscKey = false;
if (res >= 0) { if (res >= 0) {
@ -151,7 +151,7 @@ ApplicationState::eSubState WUDDumperState::update(Input *input) {
} }
size_t numSectors = this->currentSector + READ_NUM_SECTORS > this->totalSectorCount ? this->totalSectorCount - this->currentSector : READ_NUM_SECTORS; size_t numSectors = this->currentSector + READ_NUM_SECTORS > this->totalSectorCount ? this->totalSectorCount - this->currentSector : READ_NUM_SECTORS;
if ((this->readResult = FSAEx_RawReadEx(gFSAClientHandle, sectorBuf, READ_SECTOR_SIZE, numSectors, this->currentSector, this->oddFd)) >= 0) { if ((this->readResult = FSAEx_RawRead(__wut_devoptab_fs_client, sectorBuf, READ_SECTOR_SIZE, numSectors, this->currentSector, this->oddFd)) >= 0) {
auto curWrittenSectors = fileHandle->writeSector((const uint8_t *) this->sectorBuf, numSectors); auto curWrittenSectors = fileHandle->writeSector((const uint8_t *) this->sectorBuf, numSectors);
if (curWrittenSectors < 0) { if (curWrittenSectors < 0) {
this->setError(ERROR_WRITE_FAILED); this->setError(ERROR_WRITE_FAILED);
@ -180,7 +180,7 @@ ApplicationState::eSubState WUDDumperState::update(Input *input) {
} else { } else {
this->state = STATE_WAIT_USER_ERROR_CONFIRM; this->state = STATE_WAIT_USER_ERROR_CONFIRM;
if (this->oddFd >= 0) { if (this->oddFd >= 0) {
FSAEx_RawCloseEx(gFSAClientHandle, this->oddFd); FSAEx_RawClose(__wut_devoptab_fs_client, this->oddFd);
this->oddFd = -1; this->oddFd = -1;
} }
return ApplicationState::SUBSTATE_RUNNING; return ApplicationState::SUBSTATE_RUNNING;
@ -203,7 +203,7 @@ ApplicationState::eSubState WUDDumperState::update(Input *input) {
} else if (this->state == STATE_WAIT_USER_ERROR_CONFIRM) { } else if (this->state == STATE_WAIT_USER_ERROR_CONFIRM) {
if (this->autoSkipOnError) { if (this->autoSkipOnError) {
if (this->oddFd >= 0) { if (this->oddFd >= 0) {
FSAEx_RawCloseEx(gFSAClientHandle, this->oddFd); FSAEx_RawClose(__wut_devoptab_fs_client, this->oddFd);
this->oddFd = -1; this->oddFd = -1;
} }
} }

View File

@ -4,4 +4,3 @@ int ntfs_mount_count = 0;
BOOL gRunFromHBL = false; BOOL gRunFromHBL = false;
BOOL gBlockHomeButton = false; BOOL gBlockHomeButton = false;
uint32_t gBlockHomeButtonCooldown = 0; uint32_t gBlockHomeButtonCooldown = 0;
FSAClientHandle gFSAClientHandle = 0;

View File

@ -1,6 +1,5 @@
#pragma once #pragma once
#include <coreinit/filesystem_fsa.h>
#include <ntfs.h> #include <ntfs.h>
#include <wut.h> #include <wut.h>
@ -10,13 +9,12 @@
extern ntfs_md *ntfs_mounts; extern ntfs_md *ntfs_mounts;
extern int ntfs_mount_count; extern int ntfs_mount_count;
extern FSAClientHandle gFSAClientHandle; extern "C" FSClient *__wut_devoptab_fs_client;
extern BOOL gRunFromHBL; extern BOOL gRunFromHBL;
extern BOOL gBlockHomeButton; extern BOOL gBlockHomeButton;
extern uint32_t gBlockHomeButtonCooldown; extern uint32_t gBlockHomeButtonCooldown;
enum eDumpTarget { enum eDumpTarget {
TARGET_SD, TARGET_SD,
TARGET_NTFS TARGET_NTFS

View File

@ -11,7 +11,6 @@
#include <mocha/mocha.h> #include <mocha/mocha.h>
#include <ntfs.h> #include <ntfs.h>
#include <padscore/kpad.h> #include <padscore/kpad.h>
#include <sndcore2/core.h>
#include <thread> #include <thread>
#include <whb/log.h> #include <whb/log.h>
#include <whb/proc.h> #include <whb/proc.h>
@ -38,7 +37,7 @@ procHomeButtonDeniedCustom(void *context) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
initLogging(); initLogging();
AXInit(); DEBUG_FUNCTION_LINE("Hello from wudump!");
WHBProcInit(); WHBProcInit();
WiiUScreen::Init(); WiiUScreen::Init();
@ -54,7 +53,9 @@ int main(int argc, char **argv) {
ProcUIClearCallbacks(); ProcUIClearCallbacks();
ProcUIRegisterCallback(PROCUI_CALLBACK_HOME_BUTTON_DENIED, ProcUIRegisterCallback(PROCUI_CALLBACK_HOME_BUTTON_DENIED,
&procHomeButtonDeniedCustom, nullptr, 100); &procHomeButtonDeniedCustom, NULL, 100);
} else { } else {
gRunFromHBL = false; gRunFromHBL = false;
} }
@ -63,7 +64,7 @@ int main(int argc, char **argv) {
IMIsAPDEnabled(&isAPDEnabled); IMIsAPDEnabled(&isAPDEnabled);
if (isAPDEnabled) { if (isAPDEnabled) {
DEBUG_FUNCTION_LINE_VERBOSE("Disable auto shutdown"); DEBUG_FUNCTION_LINE("Disable auto shutdown");
IMDisableAPD(); IMDisableAPD();
} }
@ -75,19 +76,8 @@ int main(int argc, char **argv) {
WPADInput::init(); WPADInput::init();
gFSAClientHandle = FSAAddClient(nullptr);
if (!gFSAClientHandle) {
OSFatal("FSAAddClient failed");
}
if (Mocha_UnlockFSClientEx(gFSAClientHandle) != MOCHA_RESULT_SUCCESS) {
OSFatal("Failed to unlock FSAClientHandle");
}
main_loop(); main_loop();
FSADelClient(gFSAClientHandle);
WPADInput::close(); WPADInput::close();
if (ntfs_mounts != nullptr) { if (ntfs_mounts != nullptr) {
@ -99,7 +89,7 @@ int main(int argc, char **argv) {
} }
if (isAPDEnabled) { if (isAPDEnabled) {
DEBUG_FUNCTION_LINE_VERBOSE("Enable auto shutdown"); DEBUG_FUNCTION_LINE("Enable auto shutdown");
IMEnableAPD(); IMEnableAPD();
} }
@ -107,13 +97,12 @@ int main(int argc, char **argv) {
WiiUScreen::DeInit(); WiiUScreen::DeInit();
WHBProcShutdown(); WHBProcShutdown();
AXQuit();
return 0; return 0;
} }
void main_loop() { void main_loop() {
DEBUG_FUNCTION_LINE_VERBOSE("Creating state"); DEBUG_FUNCTION_LINE("Creating state");
std::unique_ptr<MainApplicationState> state = std::make_unique<MainApplicationState>(); std::unique_ptr<MainApplicationState> state = std::make_unique<MainApplicationState>();
CombinedInput baseInput; CombinedInput baseInput;
VPadInput vpadInput; VPadInput vpadInput;
@ -123,7 +112,7 @@ void main_loop() {
WPAD_CHAN_2, WPAD_CHAN_2,
WPAD_CHAN_3}; WPAD_CHAN_3};
DEBUG_FUNCTION_LINE_VERBOSE("Entering main loop"); DEBUG_FUNCTION_LINE("Entering main loop");
while (WHBProcIsRunning()) { while (WHBProcIsRunning()) {
baseInput.reset(); baseInput.reset();
if (vpadInput.update(1280, 720)) { if (vpadInput.update(1280, 720)) {
@ -153,7 +142,7 @@ void initMochaLib() {
void deInitMochaLib() { void deInitMochaLib() {
if (slibMochaMount) { if (slibMochaMount) {
Mocha_DeInitLibrary(); Mocha_DeinitLibrary();
} }
Mocha_sdio_disc_interface.shutdown(); Mocha_sdio_disc_interface.shutdown();