From 718ac61d77c076900a5e59c93892f94f9fe354a3 Mon Sep 17 00:00:00 2001 From: Maschell Date: Thu, 20 Jul 2017 17:28:14 +0200 Subject: [PATCH] Added option to disable the network controller --- ControllerPatcher.cpp | 8 ++++++++ ControllerPatcher.hpp | 2 ++ utils/CPRetainVars.cpp | 1 + utils/CPRetainVars.hpp | 1 + 4 files changed, 12 insertions(+) diff --git a/ControllerPatcher.cpp b/ControllerPatcher.cpp index da9be8c..878bf6e 100644 --- a/ControllerPatcher.cpp +++ b/ControllerPatcher.cpp @@ -529,11 +529,14 @@ bool ControllerPatcher::Init(){ } void ControllerPatcher::startNetworkServer(){ + if(!gNetworkControllerActivated) return; + log_printf("ControllerPatcher::startNetworkServer(line %d) statedNetworkServer! \n",__LINE__); UDPServer::getInstance(); TCPServer::getInstance(); } void ControllerPatcher::stopNetworkServer(){ + log_printf("ControllerPatcher::stopNetworkServer(line %d) called! \n",__LINE__); UDPServer::destroyInstance(); UDPClient::destroyInstance(); TCPServer::destroyInstance(); @@ -1062,6 +1065,11 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setRumbleActivated(bool va return CONTROLLER_PATCHER_ERROR_NONE; } +CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setNetworkControllerActivated(bool value){ + gNetworkControllerActivated = value; + return CONTROLLER_PATCHER_ERROR_NONE; +} + bool ControllerPatcher::isRumbleActivated(){ return gGlobalRumbleActivated; } diff --git a/ControllerPatcher.hpp b/ControllerPatcher.hpp index 427859d..2d9fd02 100644 --- a/ControllerPatcher.hpp +++ b/ControllerPatcher.hpp @@ -241,6 +241,8 @@ class ControllerPatcher{ static CONTROLLER_PATCHER_RESULT_OR_ERROR setRumbleActivated(bool value); + static CONTROLLER_PATCHER_RESULT_OR_ERROR setNetworkControllerActivated(bool value); + static bool isRumbleActivated(); }; diff --git a/utils/CPRetainVars.cpp b/utils/CPRetainVars.cpp index ebab4a3..4917d75 100644 --- a/utils/CPRetainVars.cpp +++ b/utils/CPRetainVars.cpp @@ -63,6 +63,7 @@ wpad_extension_callback_t gExtensionCallback[4] __attribute__((section(".data")) wpad_sampling_callback_t gSamplingCallback __attribute__((section(".data"))) = 0; u8 gCallbackCooldown __attribute__((section(".data"))) = 0; u8 gAppStatus __attribute__((section(".data"))) = 0; +u8 gNetworkControllerActivated __attribute__((section(".data"))) = 1; u8 gGlobalRumbleActivated __attribute__((section(".data"))) = 0; diff --git a/utils/CPRetainVars.hpp b/utils/CPRetainVars.hpp index 72aa05a..6de7c33 100644 --- a/utils/CPRetainVars.hpp +++ b/utils/CPRetainVars.hpp @@ -68,6 +68,7 @@ extern wpad_sampling_callback_t gSamplingCallback; extern u8 gCallbackCooldown; extern u8 gGlobalRumbleActivated; extern u8 gAppStatus; +extern u8 gNetworkControllerActivated; extern u32 gUDPClientip; extern ControllerMappingPADInfo* gProPadInfo[4];