ctr_Repair/trunk/ConsoleDataMigration/sources/common/Util.h
N2614 80f6c3a8f7 RTCの表示を止める
cciのみビルドするように

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@285 385bec56-5757-e545-9c3a-d8741f4650f1
2011-05-26 04:38:44 +00:00

153 lines
3.8 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*---------------------------------------------------------------------------*
Project: Horizon
File: Util.h
Copyright 2009 Nintendo. 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$
*---------------------------------------------------------------------------*/
#ifndef UTIL_H_
#define UTIL_H_
#include <string>
#include <nn.h>
#include <nn/cfg/CTR/cfg_ApiSys.h>
#include <nn/mcu.h>
#include <nn/nwm.h>
#include "VersionDetect.h"
namespace common
{
class Util
{
public:
Util();
virtual ~Util();
void Initialize();
void Finalize();
// シリアルナンバーにモジュラス10 ウェイト3・1M10W31でチェックデジットを付加する
static void AddCheckDigit(char* serial);
// IVSから計算されるセーブデータディレクトリ名を取得する
static void GetSaveDataDirectoryRoot(::std::string& sysSaveRoot, void* ivs, size_t size);
// ACアダプタが接続されているかどうか
bool IsAdapterConnected();
// バッテリ残量が10%未満かどうか
bool IsBatteryLower();
// IVSを読み取れるかどうか
bool CanReadIVS();
// シリアルナンバーを読み取れるかどうか
bool CanReadSerialNumber();
// シリアルナンバーを取得する
void GetSerialNumber(u8** serial, size_t* size);
// シリアルナンバーを返す
u8* GetSerialNumber();
// IVSを取得する
void GetIvs(void** ivs, size_t* size);
// 32bitデバイスIDを返す
bit32 GetDeviceId();
// CUPメジャーバージョンを返す
u8 GetCupMajorVersion();
// CUPマイナーバージョンを返す
u8 GetCupMinorVersion();
// CUPマイクロバージョンを返す
u8 GetCupMicroVersion();
// NUPバージョンを返す
u8 GetNupVersion();
// MCUプロセスに接続するためのハンドルを返す
nn::Handle GetMcuHandle();
// バッテリ残量を0100で返す
u32 GetBatteryRemain();
// 64bitインフラデバイスIDを返す
u64 GetInfraDeviceId();
// フレンドコードを返す
u64 GetFriendcode();
// MACアドレスを返す
char8* GetMacAddress();
// リージョンコードを返す
nn::cfg::CTR::CfgRegionCode GetRegion();
// リージョンコードを3文字のアルファベットに置き換えた文字列を返す
const char* GetRegionCodeA3();
// バージョン情報を取得する
void GetVersionData(common::VerDef* version);
private:
NN_PADDING4;
// フレンドコード
u64 m_FriendCode;
// バージョン情報
common::VerDef m_VerData;
// mcu接続のためのハンドル
nn::Handle m_McuSession;
// デバイスID
bit32 m_DeviceId;
// IVSへのポインタ
void* mp_Ivs;
// IVSのサイズ
size_t m_SizeofIvs;
NN_PADDING4;
// MCUへのポインタ
nn::mcu::CTR::HwCheck* mp_Mcu;
// リージョン
nn::cfg::CTR::CfgRegionCode m_Region;
// バッテリ残量
u8 m_BatteryRemain;
// シリアルナンバーが読めるかどうか
bool m_CanReadSerialNumber;
// IVSが読めるかどうか
bool m_CanReadIvs;
// シリアルナンバー
u8 m_SerialNo[nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN];
// MACアドレス
char8 m_MacAddress[nn::nwm::Mac::MAC_STRING_SIZE];
NN_PADDING3;
};
}
#endif /* UTIL_H_ */