diff --git a/src/utils/TcpReceiver.cpp b/src/utils/TcpReceiver.cpp index 99c7fbc..918d6a5 100644 --- a/src/utils/TcpReceiver.cpp +++ b/src/utils/TcpReceiver.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -123,6 +124,9 @@ void TcpReceiver::executeThread() { case LAUNCH_FAILED: NotificationModule_AddErrorNotification("Wiiload plugin: Failed to launch homebrew. Launching will be aborted."); break; + case NO_ACTIVE_ACCOUNT: + NotificationModule_AddErrorNotification("Wiiload plugin: Failed to launch homebrew. No active account loaded."); + break; } if (result == SUCCESS) { @@ -233,6 +237,15 @@ TcpReceiver::eLoadResults TcpReceiver::loadBinary(void *data, uint32_t fileSize) if (error != SUCCESS) { return error; } + + nn::act::Initialize(); + bool accountLoaded = nn::act::IsSlotOccupied(nn::act::GetSlotNo()); + nn::act::Finalize(); + + if (!accountLoaded) { + return NO_ACTIVE_ACCOUNT; + } + RPXLoaderStatus launchRes; if ((launchRes = RPXLoader_LaunchHomebrew(loadedPath.c_str())) != RPX_LOADER_RESULT_SUCCESS) { DEBUG_FUNCTION_LINE_ERR("Failed to start %s %s", loadedPath.c_str(), RPXLoader_GetStatusStr(launchRes)); diff --git a/src/utils/TcpReceiver.h b/src/utils/TcpReceiver.h index b8653b2..a1c5b5d 100644 --- a/src/utils/TcpReceiver.h +++ b/src/utils/TcpReceiver.h @@ -18,6 +18,7 @@ class TcpReceiver : public CThread { NOT_ENOUGH_MEMORY = -6, RECV_ERROR = -7, LAUNCH_FAILED = -8, + NO_ACTIVE_ACCOUNT = -9, }; explicit TcpReceiver(int32_t port);