/*---------------------------------------------------------------------------* Project: Horizon File: ndm_Setup.cpp Copyright (C)2009 Nintendo Co., Ltd. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Rev: 36759 $ *---------------------------------------------------------------------------*/ #include #include #include #include #include namespace nn { namespace applet { namespace CTR { // Don't do anything unnecessary when libnn_applet.a has not been linked... __declspec(noinline) NN_WEAK_SYMBOL bool IsInitialized(void) { return false; } __declspec(noinline) NN_WEAK_SYMBOL AppletAttr GetAppletType(void) { return nn::applet::TYPE_APP; } }}} namespace nn { namespace ndm { #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK //#define NN_NDM_TIMECHECK #endif void SetupDaemonsDefault(void) { #ifdef NN_NDM_TIMECHECK nn::os::Tick tickStart = nn::os::Tick::GetSystemCurrent(); #endif // The applet does nothing. Processing is only handled by the application. if (nn::applet::IsInitialized() && nn::applet::GetAppletType() == nn::applet::TYPE_APP) { NN_LOG_INFO("Overriding default daemons..."); Result result = nn::ndm::Initialize(); NN_UTIL_PANIC_IF_FAILED(result); ///////////////////////////////////////////////////// // Set the default policy for this SDK version // ///////////////////////////////////////////////////// // BOSS is disabled by default because the handling by SDK 1.x disables it mid-process. // Because processing will remain stopped even if Resume and Suspend are called from this state, temporarily restore everything to being enabled. // NOTE: This operation, too, is rolled back when the application exits. result = nn::ndm::OverrideDefaultDaemons(MASK_ALL_DAEMONS); if (result.IsFailure()) { NN_TLOG_("Failed to override default daemons. (SDK version mismatch?)\n"); nn::dbg::PrintResult(result); } // Suspend with this application's privileges so that we can start again later via Resume. result = nn::ndm::SuspendDaemons(~MASK_DEFAULT_ENABLED_DAEMONS & MASK_ALL_DAEMONS); if (result.IsFailure()) { NN_TLOG_("Failed to suspend boss daemon.\n"); nn::dbg::PrintResult(result); } } #ifdef NN_NDM_TIMECHECK NN_TLOG_("All network daemons are disabled by default at this time. (took %lldms)\n", (nn::os::Tick::GetSystemCurrent() - tickStart).ToTimeSpan().GetMilliSeconds()); #endif } } // end of namespace ndm } // end of namespace nn