まずSNAKE用のcup_versionを読みに行くように

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@811 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
N2614 2014-08-05 00:57:46 +00:00
parent 756c456562
commit 4593ad4aff
3 changed files with 239 additions and 3 deletions

View File

@ -16,6 +16,11 @@ QR
ビルド時の注意
------------
### Backup
無線自動操作、SNAKE用cup_versionタイトルのマウントのため、
CTR_SDK-3_3 branchにsources/Backup/Auto_WiFi_and_Snake_cup_version.patchを適用すること。
### AES鍵の変更
リリース用ビルドでは開発機・量産機でAES鍵を変えるため、

View File

@ -0,0 +1,226 @@
Index: include/nn/CTR/CTR_ProgramId.h
===================================================================
--- include/nn/CTR/CTR_ProgramId.h (revision 56666)
+++ include/nn/CTR/CTR_ProgramId.h (working copy)
@@ -1,8 +1,8 @@
-/*---------------------------------------------------------------------------*
+/*---------------------------------------------------------------------------*
Project: Horizon
File: CTR_ProgramId.h
- Copyright (C)2009-2011 Nintendo Co., Ltd. All rights reserved.
+ Copyright (C)2009-2013 Nintendo Co., Ltd. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
@@ -18,6 +18,7 @@
#include <nn/types.h>
+#include <nn/assert.h>
#include <nn/math/math_Utility.h>
@@ -53,7 +54,9 @@
PROGRAM_ID_CATEGORY_FLAG_CONTENTS = 3, // コンテンツ
PROGRAM_ID_CATEGORY_FLAG_ADD_ON_CONTENTS = 4, // 追加コンテンツ
PROGRAM_ID_CATEGORY_FLAG_RIGHTS_ONLY = 5, // 権利のみ
+ PROGRAM_ID_CATEGORY_FLAG_PATCH = 6, // パッチ
+ PROGRAM_ID_CATEGORY_FLAG_TYPE_MASK = (7 << 0), // 種類
PROGRAM_ID_CATEGORY_FLAG_CANNOT_EXECUTION = (1 << 3), // 実行不可
PROGRAM_ID_CATEGORY_FLAG_SYSTEM = (1 << 4), // システム
PROGRAM_ID_CATEGORY_FLAG_REQUIRE_BATCH_UPDATE = (1 << 5), // 一括アップデートが必要
@@ -120,11 +123,13 @@
| PROGRAM_ID_CATEGORY_FLAG_CANNOT_EXECUTION
| PROGRAM_ID_CATEGORY_FLAG_NOT_REQUIRE_RIGHT_FOR_MOUNT ),
-
// 権利のみ
PROGRAM_ID_CATEGORY_RIGHTS_ONLY = ( PROGRAM_ID_CATEGORY_FLAG_RIGHTS_ONLY
| PROGRAM_ID_CATEGORY_FLAG_CANNOT_EXECUTION ),
+ // パッチ
+ PROGRAM_ID_CATEGORY_PATCH = ( PROGRAM_ID_CATEGORY_FLAG_PATCH
+ | PROGRAM_ID_CATEGORY_FLAG_CANNOT_EXECUTION ),
PROGRAM_ID_CATEGORY_MAX_BITS = (1u << 15)
};
@@ -133,6 +138,7 @@
enum ProgramIdPlatform
{
PROGRAM_ID_PLATFORM_CTR,
+ PROGRAM_ID_PLATFORM_SNAKE = 2,
PROGRAM_ID_PLATFORM_MAX_BITS = (1 << 3)
};
@@ -148,7 +154,10 @@
const int PROGRAM_ID_UNIQUE_ID_SHIFT = 8;
const int PROGRAM_ID_VARIATION_SHIFT = 0;
+ const size_t PROGRAM_ID_PLATFORM_SIZE = 4;
+ const bit64 PROGRAM_ID_PLATFORM_MASK = ((1ull << PROGRAM_ID_PLATFORM_SIZE) - 1) << PROGRAM_ID_PLATFORM_SHIFT;
+
/* ------------------------------------------------------------------------
ProgramId 作成関数
------------------------------------------------------------------------ */
@@ -219,7 +228,6 @@
}
-
/* ------------------------------------------------------------------------
定数定義の代わり
------------------------------------------------------------------------ */
@@ -251,6 +259,11 @@
return 0x0004800000000000ull | (pgid & 0x00007FFFFFFFFFFFull);
}
+ inline ProgramId ReplacePlatform(ProgramId pgid, ProgramIdPlatform platform)
+ {
+ return (pgid & ~PROGRAM_ID_PLATFORM_MASK) | (platform << PROGRAM_ID_PLATFORM_SHIFT);
+ }
+
/* ------------------------------------------------------------------------
カテゴリ判別関数
------------------------------------------------------------------------ */
@@ -259,12 +272,17 @@
return (static_cast<bit32>(pgid >> 32) & 0xFFFFC000) == 0x00040000;
}
- // bit 1-2
+ // bit 0-2
inline bool IsContents(ProgramId pgid)
{
- return IsCtr(pgid) && ((GetCategoryOf(pgid) & 0x3) == PROGRAM_ID_CATEGORY_FLAG_CONTENTS);
+ return IsCtr(pgid) && ((GetCategoryOf(pgid) & PROGRAM_ID_CATEGORY_FLAG_TYPE_MASK) == PROGRAM_ID_CATEGORY_FLAG_CONTENTS);
}
+ inline bool IsNormalApplication(ProgramId pgid)
+ {
+ return IsCtr(pgid) && ((GetCategoryOf(pgid) & PROGRAM_ID_CATEGORY_FLAG_TYPE_MASK) == PROGRAM_ID_CATEGORY_FLAG_NORMAL);
+ }
+
// bit 4
inline bool IsSystem(ProgramId pgid)
{
@@ -313,6 +331,11 @@
| category == PROGRAM_ID_CATEGORY_APPLET );
}
+ inline bool IsExecutable(ProgramId pgid)
+ {
+ return (GetCategoryOf(pgid) & PROGRAM_ID_CATEGORY_FLAG_CANNOT_EXECUTION) == 0;
+ }
+
inline bool IsCtrOrTwlSystem(ProgramId pgid)
{
return IsSystem(pgid) || IsTwlSystemApp(pgid);
@@ -333,6 +356,21 @@
return IsCtr(pgid) && GetCategoryOf(pgid) == PROGRAM_ID_CATEGORY_RIGHTS_ONLY;
}
+ inline bool IsPatch(ProgramId pgid)
+ {
+ return IsCtr(pgid) && GetCategoryOf(pgid) == PROGRAM_ID_CATEGORY_PATCH;
+ }
+
+ inline bool HasInternalUniqueId(ProgramId pgid)
+ {
+ bit32 uid = GetUniqueIdOf(pgid);
+ return (uid < 0x00300)
+ || ((0xF8000 <= uid) && (uid < 0xFF000))
+ || (0xFF400 <= uid);
+ }
+
+
+
/* ------------------------------------------------------------------------
コアバージョン
------------------------------------------------------------------------ */
@@ -382,6 +420,30 @@
// 奇数のバリエーションは開発用システムのメジャーバージョン
return IsSystem(pgid) && (GetVariationOf(pgid) % 2) != 0;
}
+
+
+
+ /* ------------------------------------------------------------------------
+ 変換関数
+ ------------------------------------------------------------------------ */
+ inline ProgramId GetPatchTargetProgramId(ProgramId patchId)
+ {
+ NN_EQUAL_TASSERT_(GetCategoryOf(patchId), PROGRAM_ID_CATEGORY_PATCH);
+
+ return MakeProgramId(
+ PROGRAM_ID_CATEGORY_APPLICATION,
+ GetUniqueIdOf(patchId),
+ GetVariationOf(patchId) );
+ }
+ inline ProgramId GetPatchProgramIdOf(ProgramId appId)
+ {
+ NN_EQUAL_TASSERT_(GetCategoryOf(appId), PROGRAM_ID_CATEGORY_APPLICATION);
+
+ return MakeProgramId(
+ PROGRAM_ID_CATEGORY_PATCH,
+ GetUniqueIdOf(appId),
+ GetVariationOf(appId) );
+ }
}}
Index: sources/libraries/nwm/CTR/nwm_ExtAPI.cpp
===================================================================
--- sources/libraries/nwm/CTR/nwm_ExtAPI.cpp (revision 56666)
+++ sources/libraries/nwm/CTR/nwm_ExtAPI.cpp (working copy)
@@ -10,7 +10,7 @@
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:$
+ $Rev$
*---------------------------------------------------------------------------*/
#include <nn/srv.h>
@@ -123,15 +123,19 @@
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;
@@ -143,15 +147,20 @@
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;

View File

@ -31,9 +31,14 @@ void GetCupVersion(nn::pl::CTR::CardUpdateVersion* cup, nn::cfg::CTR::CfgRegionC
u8 buf[BUF_SIZE];
// CUPバージョン
{
result = nn::fs::MountContent("cver:", nn::fs::MEDIA_TYPE_NAND, common::cCupVerId[region], 0, 1, 1, buf,
BUF_SIZE);
COMMON_LOGGER_RESULT_IF_FAILED(result);
nn::ProgramId snakeProgramId = nn::CTR::ReplacePlatform(common::cCupVerId[region],
nn::CTR::PROGRAM_ID_PLATFORM_SNAKE);
result = nn::fs::MountContent("cver:", nn::fs::MEDIA_TYPE_NAND, snakeProgramId, 0, 1, 1, buf, BUF_SIZE);
if (result.IsFailure())
{
result = nn::fs::MountContent("cver:", nn::fs::MEDIA_TYPE_NAND, snakeProgramId, 0, 1, 1, buf, BUF_SIZE);
COMMON_LOGGER_RESULT_IF_FAILED(result);
}
nn::fs::FileInputStream fis;