From 2043a9708c223dd2c50e1370284ee5b131c9f005 Mon Sep 17 00:00:00 2001 From: N2614 Date: Mon, 27 May 2013 02:54:44 +0000 Subject: [PATCH] =?UTF-8?q?nwm=E3=81=AE=E3=83=91=E3=83=83=E3=83=81?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@738 385bec56-5757-e545-9c3a-d8741f4650f1 --- .../sources/common/nwm_ExtAPI.cpp | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 branches/1stNUP_for_2ndNUP/sources/common/nwm_ExtAPI.cpp diff --git a/branches/1stNUP_for_2ndNUP/sources/common/nwm_ExtAPI.cpp b/branches/1stNUP_for_2ndNUP/sources/common/nwm_ExtAPI.cpp new file mode 100644 index 0000000..b3dc146 --- /dev/null +++ b/branches/1stNUP_for_2ndNUP/sources/common/nwm_ExtAPI.cpp @@ -0,0 +1,193 @@ +/*---------------------------------------------------------------------------* + Project: Horizon + File: nwm_ExtAPI.cpp + + Copyright (C)2009-2011 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$ + *---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include "nwm_Ext.h" +#include +#include +#include + +using namespace nn; +using namespace nn::nwm::CTR; + + +namespace nn { +namespace nwm { +namespace CTR { + +Result InitializeExtControl() +{ + return detail::InitializeBase(&detail::Ext::s_Session, PORT_NAME_EXT); +} + +Result FinalizeExtControl() +{ + return detail::FinalizeBase(&detail::Ext::s_Session); +} + +namespace Ext { + +Result GetMacAddress( Mac& mac ) +{ + return nn::nwm::CTR::GetMacAddress( mac ); +} + +Result GetState( u16* pState ) +{ + return detail::Ext::GetState( pState ); +} + +bool IsWifiOn() +{ + return nn::nwm::CTR::IsWifiOn(); +} + +Result GetLinkLevel( LinkLevel* pLinkLevel ) +{ + if ( pLinkLevel ) + { + *pLinkLevel = nn::nwm::CTR::GetLinkLevel(); + return ResultSuccess(); + } + else + { + return ResultInvalidPointer(); + } +} + +Result GetCommunicationMode( Mode* pMode ) +{ + if ( pMode ) + { + *pMode = nn::nwm::CTR::GetCommunicationMode(); + return ResultSuccess(); + } + else + { + return ResultInvalidPointer(); + } +} + +// 以下、MP用API + +Result OpenMpMode() +{ + return detail::Ext::OpenMpMode(); +} + +Result CloseMpMode() +{ + return detail::Ext::CloseMpMode(); +} + +Result UpdateMpLinkLevel( LinkLevel linkLevel ) +{ + return detail::Ext::UpdateMpLinkLevel( linkLevel ); +} + +Result NotifyWifiOffPreparationComplete() +{ + return detail::Ext::NotifyWifiOffPreparationComplete(); +} + +Result PrepareLegacyMode(u8 pParameters[32]) +{ + return detail::Ext::PrepareLegacyMode(pParameters); +} + +Result GetHardwareInfo(HardwareInfo &info) +{ + return detail::Ext::GetHardwareInfo(&info); +} + +Result SetWifiOn() +{ + Result result; + + nn::cfg::Initialize(); + +#if 0 + // デバッグモードフラグが有効な場合のみ、操作を行う。 + if( nn::cfg::IsDebugMode() == true ) + { +#endif + result = detail::Ext::PseudoToggleWifiButton(false); +#if 0 + } + else + { + result = ResultNotAuthorized(); + } +#endif + nn::cfg::Finalize(); + + return result; +} + +Result SetWifiOff() +{ + Result result; + + nn::cfg::Initialize(); + +#if 0 + // デバッグモードフラグが有効な場合のみ、操作を行う。 + if( nn::cfg::IsDebugMode() == true ) + { +#endif + result = detail::Ext::PseudoToggleWifiButton(true); +#if 0 + } + else + { + result = ResultNotAuthorized(); + } +#endif + + nn::cfg::Finalize(); + + return result; +} + +Result SimulateFirmwareError() +{ + Result result; + + nn::cfg::Initialize(); + + // デバッグモードフラグが有効な場合のみ、操作を行う。 + if( nn::cfg::IsDebugMode() == true ) + { + result = detail::Ext::SimulateFirmwareError(); + } + else + { + result = ResultNotAuthorized(); + } + nn::cfg::Finalize(); + + return result; +} + +} // namespace Ext + +} // namespace CTR +} // namespace nwm +} // namespace nn