Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better IRX error handling #165

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 additions & 22 deletions engine/src/irx/irx_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,29 +109,28 @@ int IrxLoader::applyRpcPatches() {
void IrxLoader::loadLibsd(const bool& verbose) {
if (verbose) TYRA_LOG("IRX: Loading libsd...");

int ret;
SifExecModuleBuffer(&libsd_irx, size_libsd_irx, 0, nullptr, &ret);
TYRA_ASSERT(ret >= 0, "Failed to load module: libsd_irx");
int ret, irx_id;
irx_id = SifExecModuleBuffer(&libsd_irx, size_libsd_irx, 0, nullptr, &ret);
TYRA_ASSERT((ret != 1) && (irx_id > 0), "Failed to load module: libsd_irx id:", idx_id, ", ret:", ret);

if (verbose) TYRA_LOG("IRX: Libsd loaded!");
}

void IrxLoader::loadUsbModules(const bool& verbose) {
if (verbose) TYRA_LOG("IRX: Loading usb modules...");

int ret;

SifExecModuleBuffer(&usbd_irx, size_usbd_irx, 0, nullptr, &ret);
TYRA_ASSERT(ret >= 0, "Failed to load module: usbd_irx");
int ret, irx_id;
irx_id = SifExecModuleBuffer(&usbd_irx, size_usbd_irx, 0, nullptr, &ret);
TYRA_ASSERT((ret != 1) && (irx_id > 0), "Failed to load module: usbd_irx id:", idx_id, ", ret:", ret);

SifExecModuleBuffer(&bdm_irx, size_bdm_irx, 0, nullptr, &ret);
TYRA_ASSERT(ret >= 0, "Failed to load module: bdm_irx");
irx_id = SifExecModuleBuffer(&bdm_irx, size_bdm_irx, 0, nullptr, &ret);
TYRA_ASSERT((ret != 1) && (irx_id > 0), "Failed to load module: bdm_irx id:", idx_id, ", ret:", ret);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

irx_id = SifExecModuleBuffer(&bdm_irx, size_bdm_irx, 0, nullptr, &ret);
TYRA_ASSERT((ret != 1) && (irx_id > 0), "Failed to load module: bdm_irx id:", idx_id, ", ret:", ret);

idx_id is not defined.


SifExecModuleBuffer(&bdmfs_fatfs_irx, size_bdmfs_fatfs_irx, 0, nullptr, &ret);
TYRA_ASSERT(ret >= 0, "Failed to load module: bdmfs_fatfs");
irx_id = SifExecModuleBuffer(&bdmfs_fatfs_irx, size_bdmfs_fatfs_irx, 0, nullptr, &ret);
TYRA_ASSERT((ret != 1) && (irx_id > 0), "Failed to load module: bdmfs_fatfs id:", idx_id, ", ret:", ret);

SifExecModuleBuffer(&usbmass_bd_irx, size_usbmass_bd_irx, 0, nullptr, &ret);
TYRA_ASSERT(ret >= 0, "Failed to load module: usbmass");
irx_id = SifExecModuleBuffer(&usbmass_bd_irx, size_usbmass_bd_irx, 0, nullptr, &ret);
TYRA_ASSERT((ret != 1) && (irx_id > 0), "Failed to load module: usbmass id:", idx_id, ", ret:", ret);

waitUntilUsbDeviceIsReady();

Expand All @@ -141,29 +140,29 @@ void IrxLoader::loadUsbModules(const bool& verbose) {
void IrxLoader::loadAudsrv(const bool& verbose) {
if (verbose) TYRA_LOG("IRX: Loading audsrv...");

int ret;
SifExecModuleBuffer(&audsrv_irx, size_audsrv_irx, 0, nullptr, &ret);
TYRA_ASSERT(ret >= 0, "Failed to load module: audsrv_irx");
int ret, irx_id;
irx_id = SifExecModuleBuffer(&audsrv_irx, size_audsrv_irx, 0, nullptr, &ret);
TYRA_ASSERT((ret != 1) && (irx_id > 0), "Failed to load module: audsrv_irx id:", idx_id, ", ret:", ret);

if (verbose) TYRA_LOG("IRX: Audsrv loaded!");
}

void IrxLoader::loadSio2man(const bool& verbose) {
if (verbose) TYRA_LOG("IRX: Loading sio2man...");

int ret;
SifExecModuleBuffer(&sio2man_irx, size_sio2man_irx, 0, nullptr, &ret);
TYRA_ASSERT(ret >= 0, "Failed to load module: sio2man_irx");
int ret, irx_id;
irx_id = SifExecModuleBuffer(&sio2man_irx, size_sio2man_irx, 0, nullptr, &ret);
TYRA_ASSERT((ret != 1) && (irx_id > 0), "Failed to load module: sio2man_irx id:", idx_id, ", ret:", ret);

if (verbose) TYRA_LOG("IRX: Sio2man loaded!");
}

void IrxLoader::loadPadman(const bool& verbose) {
if (verbose) TYRA_LOG("IRX: Loading padman...");

int ret;
SifExecModuleBuffer(&padman_irx, size_padman_irx, 0, nullptr, &ret);
TYRA_ASSERT(ret >= 0, "Failed to load module: padman_irx");
int ret, irx_id;
irx_id = SifExecModuleBuffer(&padman_irx, size_padman_irx, 0, nullptr, &ret);
TYRA_ASSERT((ret != 1) && (irx_id > 0), "Failed to load module: padman_irx id:", idx_id, ", ret:", ret);

if (verbose) TYRA_LOG("IRX: Padman loaded!");
}
Expand Down
Loading