mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@731 385bec56-5757-e545-9c3a-d8741f4650f1
194 lines
3.9 KiB
C++
194 lines
3.9 KiB
C++
/*---------------------------------------------------------------------------*
|
|
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 <nn/srv.h>
|
|
#include <nn/nwm/CTR/nwm_ExtAPI.h>
|
|
#include <nn/nwm/CTR/nwm_ExtMpAPI.h>
|
|
#include <nn/nwm/CTR/nwm_ExtLgyAPI.h>
|
|
#include <nn/nwm/CTR/nwm_ExtHwAPI.h>
|
|
#include <nn/nwm/nwm_Result.h>
|
|
#include "nwm_Ext.h"
|
|
#include <nn/os/os_HandleManager.h>
|
|
#include <nn/cfg.h>
|
|
#include <nn/cfg/CTR/cfg_DebugParam.h>
|
|
|
|
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
|