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@246 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
110d486bf5
commit
a97c03a0c2
@ -132,7 +132,7 @@ extern "C" void nnMain(void)
|
||||
common::Logger::InitializeEjectThread();
|
||||
common::Logger::SetEjectHandler(OnSdEjected);
|
||||
// 起動時に削除
|
||||
common::Logger::GetLoggerInstance()->ClearLog();
|
||||
common::Logger::GetLoggerInstance()->ClearSdLog();
|
||||
|
||||
COMMON_LOGGER("\n");
|
||||
COMMON_LOGGER("CTR Console Backup start\n");
|
||||
|
||||
@ -168,7 +168,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
}
|
||||
|
||||
// 処理が完了した
|
||||
if (IsExportFinished())
|
||||
if (IsExportThreadFinished())
|
||||
{
|
||||
FinalizeExportThread();
|
||||
s_BackupState = EXPORT_TWL_SOUND;
|
||||
@ -188,7 +188,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
}
|
||||
|
||||
// 処理が完了した
|
||||
if (IsExportFinished())
|
||||
if (IsExportThreadFinished())
|
||||
{
|
||||
FinalizeExportThread();
|
||||
s_BackupState = EXPORT_TWL_PHOTO;
|
||||
@ -208,7 +208,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
}
|
||||
|
||||
// 処理が完了した
|
||||
if (IsExportFinished())
|
||||
if (IsExportThreadFinished())
|
||||
{
|
||||
FinalizeExportThread();
|
||||
s_BackupState = EXPORT_CTR_NAND;
|
||||
@ -232,7 +232,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
ExportData(manager);
|
||||
|
||||
// 処理が完了した
|
||||
if (continueBackup && IsExportFinished())
|
||||
if (continueBackup && IsExportThreadFinished())
|
||||
{
|
||||
FinalizeExportThread();
|
||||
COMMON_LOGGER("Export NAND Data Finished.\n");
|
||||
|
||||
@ -23,12 +23,27 @@
|
||||
namespace ConsoleBackup
|
||||
{
|
||||
|
||||
// 状態遷移を管理する
|
||||
// manager ハードウェア情報を取得するためのラッパ
|
||||
// operationMessage 操作情報として表示したい文字列
|
||||
// nextStep 次の状態に遷移してもよいかどうか
|
||||
// continueBackup 処理を続けてもよいかどうか
|
||||
void ControlState(common::HardwareStateManager& manager, ::std::vector<std::string>& operationMessage, bool& nextStep,
|
||||
bool& continueBackup);
|
||||
|
||||
// バックアップ処理中かどうか
|
||||
bool InProgress();
|
||||
|
||||
// バックアップが完了したかどうか
|
||||
bool IsBackupSucceeded();
|
||||
|
||||
// バックアップが失敗したかどうか
|
||||
bool IsBackupFailed();
|
||||
|
||||
// SDカードが抜き出されたときに実行したい関数
|
||||
void OnSdEjected();
|
||||
|
||||
// 状態を初期化する
|
||||
void InitializeState();
|
||||
|
||||
}
|
||||
|
||||
@ -883,7 +883,7 @@ u32 GetProgress()
|
||||
return common::GetProgress();
|
||||
}
|
||||
|
||||
bool IsExportFinished()
|
||||
bool IsExportThreadFinished()
|
||||
{
|
||||
return s_ExportThread.IsValid() && !s_ExportThread.IsAlive();
|
||||
}
|
||||
|
||||
@ -22,16 +22,33 @@
|
||||
namespace ConsoleBackup
|
||||
{
|
||||
|
||||
// 出力ファイルリストのコンテキストを初期化する。出力ファイルリストを
|
||||
// 生成する前に必ず呼び出す必要がある
|
||||
void InitializeFileListContext();
|
||||
void ExportTwlTitleList();
|
||||
|
||||
// 新たにスレッドを起動して、DSiWareのセーブデータをSDカードに出力する
|
||||
void ExportTwlSaveData();
|
||||
|
||||
// 新たにスレッドを起動して、TWL写真領域のデータをSDカードに出力する
|
||||
void ExportTwlPhotoData();
|
||||
|
||||
// 新たにスレッドを起動して、TWLサウンド領域のデータをSDカードに出力する
|
||||
void ExportTwlSoundData();
|
||||
|
||||
// 本体固有情報をSDカードに出力する
|
||||
// 新たにスレッドを起動して、CTR領域のセーブデータをSDカードに出力する
|
||||
void ExportData(common::HardwareStateManager& manager);
|
||||
|
||||
// NIMのセーブデータをSDカードから削除する
|
||||
void DeleteNimSaveData();
|
||||
|
||||
// 出力スレッドの進捗を返す
|
||||
u32 GetProgress();
|
||||
bool IsExportFinished();
|
||||
|
||||
// 出力スレッドが終了したかどうか
|
||||
bool IsExportThreadFinished();
|
||||
|
||||
// 出力スレッドを終了する
|
||||
void FinalizeExportThread();
|
||||
|
||||
|
||||
|
||||
@ -1051,7 +1051,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
}
|
||||
|
||||
// 処理が完了した
|
||||
if (IsImportFinished())
|
||||
if (IsImportThreadFinished())
|
||||
{
|
||||
FinalizeImportThread();
|
||||
s_RestoreState = RESTORE_TWL_PHOTO;
|
||||
@ -1071,7 +1071,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
}
|
||||
|
||||
// 処理が完了した
|
||||
if (IsImportFinished())
|
||||
if (IsImportThreadFinished())
|
||||
{
|
||||
FinalizeImportThread();
|
||||
s_RestoreState = RESTORE_IN_PROGRESS;
|
||||
@ -1095,7 +1095,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
}
|
||||
|
||||
// 処理が完了した
|
||||
if (!NeedsAcAdater(manager) && IsImportFinished())
|
||||
if (!NeedsAcAdater(manager) && IsImportThreadFinished())
|
||||
{
|
||||
COMMON_LOGGER("Import NAND Data Finished.\n");
|
||||
|
||||
@ -1255,7 +1255,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
}
|
||||
|
||||
// 処理が完了した
|
||||
if (IsImportFinished())
|
||||
if (IsImportThreadFinished())
|
||||
{
|
||||
FinalizeImportThread();
|
||||
s_RestoreState = TIME_ADJUST;
|
||||
|
||||
@ -31,17 +31,39 @@ typedef enum RestoreMode
|
||||
RESTORE_MODE_GET_IVS
|
||||
} RestoreMode;
|
||||
|
||||
// ネットワーク処理のリトライ回数の最大値
|
||||
const u32 RETRY_MAX = 3;
|
||||
|
||||
// 状態遷移を管理する
|
||||
// manager ハードウェア情報を取得するためのラッパ
|
||||
// operationMessage 操作情報として表示したい文字列
|
||||
// nextStep 次の状態に遷移してもよいかどうか
|
||||
// continueBackup 処理を続けてもよいかどうか
|
||||
void ControlState(common::HardwareStateManager& manager, ::std::vector<std::string>& operationMessage, bool& nextStep);
|
||||
|
||||
// リストア処理中かどうか
|
||||
bool InProgress();
|
||||
|
||||
// リストアが完了したかどうか
|
||||
bool IsRestoreSucceeded();
|
||||
|
||||
// リストアが失敗したかどうか
|
||||
bool IsRestoreFailed();
|
||||
|
||||
// 書き込みスレッドの進捗を返す
|
||||
u32 GetProgress();
|
||||
|
||||
|
||||
// SDカードが抜き出されたときに実行したい関数
|
||||
void OnSdEjected();
|
||||
|
||||
// SDカードが挿入されたときに実行したい関数
|
||||
void OnSdInserted();
|
||||
|
||||
// 状態を初期化する
|
||||
void InitializeState();
|
||||
|
||||
// リストア状態を取得する
|
||||
RestoreMode GetRestoreMode();
|
||||
|
||||
}
|
||||
|
||||
@ -909,7 +909,7 @@ void FinalizeImportThread()
|
||||
s_ImportThread.Finalize();
|
||||
}
|
||||
|
||||
bool IsImportFinished()
|
||||
bool IsImportThreadFinished()
|
||||
{
|
||||
return s_ImportThread.IsValid() && !s_ImportThread.IsAlive();
|
||||
}
|
||||
|
||||
@ -25,29 +25,66 @@
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
|
||||
// SDカードのデバイスIDファイルと本体のデバイスIDが一致しているかどうか
|
||||
nn::Result EqualsDeviceIdFileandDeviceId(common::HardwareStateManager& manager);
|
||||
|
||||
// SDカードのリージョンと本体のリージョンが一致しているかどうか
|
||||
nn::Result EqualsRegionDataandRegion();
|
||||
|
||||
// シリアルナンバーを取得する
|
||||
nn::Result ReadSerialNumber(u8* serial);
|
||||
|
||||
// 出力ファイル一覧を読み込む
|
||||
nn::Result SetupFileList();
|
||||
|
||||
// インポート用のスレッドを終了する
|
||||
void FinalizeImportThread();
|
||||
bool IsImportFinished();
|
||||
|
||||
// インポート用のスレッドが終了したかどうか
|
||||
bool IsImportThreadFinished();
|
||||
|
||||
// 新たにスレッドを立て、TWLサウンド領域をインポートする
|
||||
void ImportTwlSoundData();
|
||||
|
||||
// 新たにスレッドを立て、TWL-NAND領域をインポートする
|
||||
void ImportTwlSaveData();
|
||||
|
||||
// 新たにスレッドを立て、TWL写真領域をインポートする
|
||||
void ImportTwlPhotoData();
|
||||
|
||||
// 本体固有データを読み込む
|
||||
// 新たにスレッドを立て、CTRセーブデータ領域をインポートする
|
||||
nn::Result ImportData();
|
||||
|
||||
// インポート完了ファイルを作る
|
||||
void CreateWriteFinishedFile();
|
||||
|
||||
// ネットワークアップデート完了ファイルを作る
|
||||
void CreateUpdateFinishedFile();
|
||||
|
||||
// 本体初期化完了ファイルを作る
|
||||
void CreateConsoleInitializedFile();
|
||||
|
||||
// RTC書き込み完了ファイルを作る
|
||||
void CreateRtcSyncFinishedFile();
|
||||
|
||||
// IVSダウンロード完了ファイルを作る
|
||||
void CreateDownloadIvsFinishedFile();
|
||||
|
||||
// アカウント削除完了ファイルを作る
|
||||
void CreateDeleteAccountFinishedFile();
|
||||
|
||||
// アカウント移行完了ファイルを作る
|
||||
void CreateTransferAccountFinishedFile();
|
||||
|
||||
// インポートスレッドの進捗を取得する
|
||||
u32 GetImportProgress();
|
||||
|
||||
// NANDのごみを削除する
|
||||
void Cleanup();
|
||||
|
||||
|
||||
// ファイルが存在するかどうか確認するためのテーブル
|
||||
const wchar_t* const CHECK_FILENAME_TABLE[] =
|
||||
{
|
||||
common::UPDATE_CHECK_PATHNAME,
|
||||
@ -59,6 +96,7 @@ const wchar_t* const CHECK_FILENAME_TABLE[] =
|
||||
common::TRANSFER_ACCOUNT_CHECK_PATHNAME
|
||||
};
|
||||
|
||||
// ファイル存在確認をクリアする
|
||||
void DeleteAllCheckFiles();
|
||||
|
||||
struct TimeZone
|
||||
@ -69,8 +107,15 @@ struct TimeZone
|
||||
NN_PADDING3;
|
||||
};
|
||||
|
||||
// ネットワーク設定ファイルを読み込む
|
||||
bool ReadSetting(bool* nupOnly, bool* getIvs);
|
||||
|
||||
// ネットワーク設定ファイルからNTPサーバの名前を取得する
|
||||
// 先にReadSettingが成功している必要がある
|
||||
char* GetNtpServerName();
|
||||
|
||||
// ネットワーク設定ファイルからタイムゾーンを取得する
|
||||
// 先にReadSettingが成功している必要がある
|
||||
TimeZone GetTimeZone();
|
||||
|
||||
struct CheckedNetworkSetting
|
||||
@ -80,13 +125,21 @@ struct CheckedNetworkSetting
|
||||
NN_PADDING3;
|
||||
};
|
||||
|
||||
// SDカードから読み込んだネットワーク設定ファイルから生成した
|
||||
// インターネット設定へのポインタを取得する
|
||||
// インターネット設定は内部のバッファに読み込む
|
||||
CheckedNetworkSetting* GetTempNetworkSetting();
|
||||
|
||||
// 国設定を読み込む
|
||||
nn::Result ImportCountryLanguageData();
|
||||
|
||||
// RTCを読み込む
|
||||
nn::Result ImportMcuRtc(common::HardwareStateManager& manager);
|
||||
|
||||
// TWL写真領域を初期化してから本体初期化を行う
|
||||
void InitializeFileSystem();
|
||||
|
||||
// SDカードのファイルと本体情報の比較結果をクリアする
|
||||
void ClearFileReadResult();
|
||||
|
||||
// プレイ履歴を読み込みます。ptmのセーブデータ移行後に呼び出す必要があります
|
||||
|
||||
@ -19,8 +19,13 @@
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
|
||||
// 新たにスレッドを立て、NTPサーバと同期する
|
||||
u32 AdjustTime();
|
||||
|
||||
// NTPサーバとの同期が終了したかどうか
|
||||
bool IsTimeAdjustFinished();
|
||||
|
||||
// NTPサーバとの同期が完了したかどうか
|
||||
bool IsTimeAdjustSuccessed();
|
||||
|
||||
}
|
||||
|
||||
@ -19,11 +19,12 @@
|
||||
#include <nn.h>
|
||||
#include <nn/nim.h>
|
||||
|
||||
const char* const CONSOLE_RESTORE_TIN = "987654321";
|
||||
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
|
||||
// ショップサーバにConsoleResotoreが接続するためのTINコード
|
||||
const char* const CONSOLE_RESTORE_TIN = "987654321";
|
||||
|
||||
typedef enum SHOP_OPERATION
|
||||
{
|
||||
SHOP_OPERATION_CONNECT, // Shop::ConnectしてCloseするだけ
|
||||
@ -35,6 +36,7 @@ typedef enum SHOP_OPERATION
|
||||
|
||||
} ShopOperation;
|
||||
|
||||
// ショップ操作のモード表示用文字列(デバッグ用)
|
||||
const char* const SHOP_OPERATION_STR[] =
|
||||
{
|
||||
"Connect",
|
||||
@ -44,10 +46,19 @@ const char* const SHOP_OPERATION_STR[] =
|
||||
"Download Title"
|
||||
};
|
||||
|
||||
// 新たにスレッドを立て、ショップ操作を開始する
|
||||
void StartShopOperationSingle(ShopOperation op, nn::nim::TitleConfig config);
|
||||
|
||||
// 新たにスレッドを立て、ショップ操作を開始する
|
||||
void StartShopOperationSingle(ShopOperation op);
|
||||
|
||||
// ショップ操作スレッドを終了する
|
||||
void FinalizeShopOperationSingle();
|
||||
|
||||
// ショップ操作スレッドが終了したかどうか
|
||||
bool IsShopOperationSingleFinished();
|
||||
|
||||
// ショップ操作のResultを取得する
|
||||
nn::Result GetShopOperationSingleResult();
|
||||
|
||||
}
|
||||
|
||||
@ -21,17 +21,23 @@
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
|
||||
// 新たにスレッドを立て、タイトルのダウンロードを開始する
|
||||
void StartTitleDownload();
|
||||
|
||||
// タイトルのダウンロードスレッドを終了する
|
||||
bool DownloadTitleFinished();
|
||||
|
||||
// タイトルのダウンロードスレッドが成功したかどうか
|
||||
bool DownloadTitleSucceeded();
|
||||
|
||||
|
||||
// ショップからタイトルをダウンロードするためのクラス
|
||||
class TitleDownloader
|
||||
{
|
||||
public:
|
||||
TitleDownloader();
|
||||
virtual ~TitleDownloader();
|
||||
|
||||
// タイトルのダウンロードを開始する
|
||||
void Start();
|
||||
|
||||
NN_PADDING4;
|
||||
|
||||
@ -21,10 +21,19 @@
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
|
||||
// 新たにスレッドを立て、ネットワークアップデートを開始する
|
||||
void StartFGNetworkUpdate();
|
||||
|
||||
// ネットワークアップデートスレッドを終了する
|
||||
void FinishFGNetworkUpdate();
|
||||
|
||||
// ネットワークアップデートスレッドが終了したかどうか
|
||||
bool IsNetworkUpdateFinished();
|
||||
|
||||
// ネットワークアップデートの進捗を取得する
|
||||
u32 GetUpdateProgress();
|
||||
|
||||
// ネットワークアップデートのResultを取得する
|
||||
nn::Result GetUpdateResult();
|
||||
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ void CommonLogger::Print(const char* fmt, ...)
|
||||
va_end(vlist);
|
||||
}
|
||||
|
||||
void CommonLogger::PrintResult(const char* fmt, ...)
|
||||
void CommonLogger::PrintResultSdLog(const char* fmt, ...)
|
||||
{
|
||||
nn::os::CriticalSection::ScopedLock lock(m_CriticalSection);
|
||||
va_list vlist;
|
||||
@ -76,7 +76,7 @@ void CommonLogger::PrintResult(const char* fmt, ...)
|
||||
va_end(vlist);
|
||||
}
|
||||
|
||||
void CommonLogger::ClearLog()
|
||||
void CommonLogger::ClearSdLog()
|
||||
{
|
||||
nn::os::CriticalSection::ScopedLock lock(m_CriticalSection);
|
||||
GetSdInstance()->Clear();
|
||||
|
||||
@ -20,21 +20,20 @@
|
||||
#include "demo.h"
|
||||
|
||||
#include "SdLogger.h"
|
||||
#include "LogConsole.h"
|
||||
|
||||
#define COMMON_LOGGER( ... ) (void)common::Logger::GetLoggerInstance()->Print(__VA_ARGS__)
|
||||
#define COMMON_LOGGER_RESULT(result, func) \
|
||||
(void)nn::dbg::PrintResult(result); \
|
||||
(void)common::Logger::GetLoggerInstance()->PrintResult("Func = %s\n", func); \
|
||||
(void)common::Logger::GetLoggerInstance()->PrintResult("Result = %X\n", result.GetPrintableBits()); \
|
||||
(void)common::Logger::GetLoggerInstance()->PrintResultSdLog("Func = %s\n", func); \
|
||||
(void)common::Logger::GetLoggerInstance()->PrintResultSdLog("Result = %X\n", result.GetPrintableBits()); \
|
||||
|
||||
#define COMMON_LOGGER_RESULT_WITH_LINE(result, line, func) \
|
||||
(void)nn::dbg::detail::Printf("%s\n", func); \
|
||||
(void)nn::dbg::detail::Printf("%d\n", line); \
|
||||
(void)nn::dbg::PrintResult(result); \
|
||||
(void)common::Logger::GetLoggerInstance()->PrintResult("Func = %s\n", func); \
|
||||
(void)common::Logger::GetLoggerInstance()->PrintResult("line = %d\n", line); \
|
||||
(void)common::Logger::GetLoggerInstance()->PrintResult("Result = %X\n", result.GetPrintableBits()); \
|
||||
(void)common::Logger::GetLoggerInstance()->PrintResultSdLog("Func = %s\n", func); \
|
||||
(void)common::Logger::GetLoggerInstance()->PrintResultSdLog("line = %d\n", line); \
|
||||
(void)common::Logger::GetLoggerInstance()->PrintResultSdLog("Result = %X\n", result.GetPrintableBits()); \
|
||||
|
||||
#define COMMON_LOGGER_RESULT_IF_FAILED(result) \
|
||||
if(result.IsFailure()) \
|
||||
@ -54,6 +53,7 @@ namespace common
|
||||
namespace Logger
|
||||
{
|
||||
|
||||
// SDカードのログと下画面ログを同時に扱うためのクラス
|
||||
class CommonLogger
|
||||
{
|
||||
public:
|
||||
@ -63,13 +63,28 @@ public:
|
||||
void Initialize(u32 width, u32 height, u32 maxLine, demo::RenderSystemDrawing* renderSystem);
|
||||
void Finalize();
|
||||
|
||||
// SDログに書き込み、下画面ログ出力のためのバッファに溜め込む
|
||||
void Print(const char* fmt, ...);
|
||||
void PrintResult(const char* fmt, ...);
|
||||
void ClearLog();
|
||||
|
||||
// SDログのみにResult値を出力する
|
||||
void PrintResultSdLog(const char* fmt, ...);
|
||||
|
||||
// SDカードのログファイルを消去する
|
||||
void ClearSdLog();
|
||||
|
||||
// 下画面ログを上スクロールする
|
||||
void ScrollUp();
|
||||
|
||||
// 下画面ログを下スクロールする
|
||||
void ScrollDown();
|
||||
|
||||
// 下画面ログの先頭にスクロールする
|
||||
void ScrollToBegin();
|
||||
|
||||
// 下画面ログの末尾にスクロールする
|
||||
void ScrollToEnd();
|
||||
|
||||
// バッファに溜め込まれた文字列を下画面ログに書き込む
|
||||
void DrawConsole();
|
||||
private:
|
||||
nn::os::CriticalSection m_CriticalSection;
|
||||
|
||||
@ -43,8 +43,13 @@
|
||||
namespace common
|
||||
{
|
||||
|
||||
// 現在の描画先ディスプレイを返す
|
||||
// target NN_GX_DISPLAY0 または NN_GX_DISPLAY1
|
||||
// flip 上下画面を入れ替えているかどうか
|
||||
u32 GetRenderTarget(u32 target, bool flip = false);
|
||||
|
||||
// システム状態を描画する
|
||||
// InitializeResFont()、demo::RenderSystemDrawing.Initializeが呼び出されている必要がある
|
||||
void DrawSystemState
|
||||
(
|
||||
const char* toolName,
|
||||
|
||||
@ -116,11 +116,6 @@ bool ExistsCountryLanguageFile()
|
||||
return ExistsFile(EXISTS_COUNTRY_LANGUAGE);
|
||||
}
|
||||
|
||||
bool ExistsVersionData()
|
||||
{
|
||||
return ExistsFile(EXISTS_VERSION_DATA);
|
||||
}
|
||||
|
||||
bool ExistsRegionData()
|
||||
{
|
||||
return ExistsFile(EXISTS_REGION_DATA);
|
||||
|
||||
@ -21,24 +21,25 @@
|
||||
namespace common
|
||||
{
|
||||
|
||||
// チェックしたいファイルのリスト
|
||||
typedef enum FILE_EXISTS_CHECK
|
||||
{
|
||||
EXISTS_UPDATE_FINISHED,
|
||||
EXISTS_SERIAL_NUMBER,
|
||||
EXISTS_IVS,
|
||||
EXISTS_CONSOLE_INTIALIZED,
|
||||
EXISTS_WRITE_FINISHED,
|
||||
EXISTS_AP_SETTING,
|
||||
EXISTS_RTC_SYNC_FINISHED,
|
||||
EXISTS_COUNTRY_LANGUAGE,
|
||||
EXISTS_VERSION_DATA,
|
||||
EXISTS_REGION_DATA,
|
||||
EXISTS_DELETE_ACCOUNT,
|
||||
EXISTS_TRANSFER_ACCOUNT,
|
||||
EXISTS_DOWNLOAD_IVS,
|
||||
EXISTS_UPDATE_FINISHED, // ネットワークアップデート完了
|
||||
EXISTS_SERIAL_NUMBER, // シリアルナンバー
|
||||
EXISTS_IVS, // IVS
|
||||
EXISTS_CONSOLE_INTIALIZED, // 本体初期化完了
|
||||
EXISTS_WRITE_FINISHED, // 書き込み完了
|
||||
EXISTS_AP_SETTING, // 無線設定ファイル
|
||||
EXISTS_RTC_SYNC_FINISHED, // RTC書き込み完了
|
||||
EXISTS_COUNTRY_LANGUAGE, // 国設定書き込み完了
|
||||
EXISTS_REGION_DATA, // リージョン
|
||||
EXISTS_DELETE_ACCOUNT, // アカウント削除完了
|
||||
EXISTS_TRANSFER_ACCOUNT, // アカウント移行完了
|
||||
EXISTS_DOWNLOAD_IVS, // IVSダウロード完了
|
||||
EXISTS_MAX
|
||||
} FileExistsCheck;
|
||||
|
||||
// チェックしたいファイルのリストに対応したパス
|
||||
const wchar_t* const FILENAME_TABLE[EXISTS_MAX] =
|
||||
{
|
||||
common::UPDATE_CHECK_PATHNAME,
|
||||
@ -49,14 +50,15 @@ const wchar_t* const FILENAME_TABLE[EXISTS_MAX] =
|
||||
common::AP_SETTING_PATHNAME,
|
||||
common::RTC_SYNC_CHECK_PATHNAME,
|
||||
common::COUNTRY_SETTING_PATHNAME,
|
||||
common::VERSION_DATA_PATHNAME,
|
||||
common::REGION_DATA_PATHNAME,
|
||||
common::DELETE_ACCOUNT_CHECK_PATHNAME,
|
||||
common::TRANSFER_ACCOUNT_CHECK_PATHNAME,
|
||||
common::DOWNLOAD_IVS_CHECK_PATHNAME
|
||||
};
|
||||
|
||||
// ファイルが存在するかどうか
|
||||
bool CheckFileExists(const wchar_t* path);
|
||||
|
||||
bool ExistsUpdateCheckedFile();
|
||||
bool ExistsSerialNumberFile();
|
||||
bool ExistsIVSFile();
|
||||
@ -65,14 +67,17 @@ bool ExistsWriteFinishedFile();
|
||||
bool ExistsAPSetting();
|
||||
bool ExistsRtcSyncFinishedFile();
|
||||
bool ExistsCountryLanguageFile();
|
||||
bool ExistsVersionData();
|
||||
bool ExistsRegionData();
|
||||
bool ExistsDeleteAccountChecked();
|
||||
bool ExistsTransferAccountChecked();
|
||||
bool ExistsDownloadIvsCheckedFile();
|
||||
|
||||
// ファイルチェックの結果を初期化する
|
||||
// 一度チェックするとその結果を保持するため
|
||||
// ファイルを作成したり削除した時に呼ぶ必要がある
|
||||
void ClearFileCheck(FileExistsCheck index);
|
||||
|
||||
// 全てのファイルチェックの結果を初期化する
|
||||
void InitializeFileCheck();
|
||||
|
||||
}
|
||||
|
||||
@ -134,8 +134,6 @@ bool ExistsInList(ImportDataList* fileList, const wchar_t* path, bool isDirector
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
// 単一のディレクトリを作成する
|
||||
// アーカイブはマウント済みにしておく
|
||||
void ExportTwlSaveDirectory(const wchar_t* dirPath, nn::fs::FileOutputStream* list,
|
||||
nn::crypto::Sha256Context* listContext)
|
||||
{
|
||||
@ -147,8 +145,6 @@ void ExportTwlSaveDirectory(const wchar_t* dirPath, nn::fs::FileOutputStream* li
|
||||
AddPathNameAndUpdateContext(list, dirPath, -1, listContext);
|
||||
}
|
||||
|
||||
// 単一のファイルをコピーする
|
||||
// アーカイブはマウント済みにしておく
|
||||
bool ExportTwlSaveFile(const wchar_t* from_path, const wchar_t* to_path, void* buf, const size_t bufSize,
|
||||
nn::fs::FileOutputStream* list, nn::crypto::Sha256Context* listContext)
|
||||
{
|
||||
@ -309,12 +305,6 @@ bool ExportTwlSaveFile(const wchar_t* from_path, const wchar_t* to_path, void* b
|
||||
}
|
||||
|
||||
|
||||
// ディレクトリ間のコピー
|
||||
// アーカイブ越しのコピーが可能
|
||||
// アーカイブにマウントした状態で呼び出す必要あり
|
||||
// 書き込み先のディレクトリはあらかじめ消去しておくこと。
|
||||
// 引数はスラッシュ付き
|
||||
// TODO:分割して短くする
|
||||
bool CopyDirectory(ImportDataList* fileList, const wchar_t * from_path, const wchar_t * to_path, void* buf,
|
||||
const size_t bufSize, bool encode, nn::fs::FileOutputStream* list, nn::crypto::Sha256Context* listContext)
|
||||
{
|
||||
|
||||
@ -24,16 +24,37 @@
|
||||
namespace common
|
||||
{
|
||||
|
||||
// currentDirectory以下のファイル数、ファイルサイズを再帰的に計算する
|
||||
nn::Result CalculateFileNum(std::wstring currentDirectory, u32& fileNum, s64& fileSize);
|
||||
|
||||
// 単一のディレクトリを作成する
|
||||
// アーカイブはマウント済みにしておく
|
||||
void ExportTwlSaveDirectory(const wchar_t* dirPath, nn::fs::FileOutputStream* list,
|
||||
nn::crypto::Sha256Context* listContext);
|
||||
|
||||
// 単一のファイルをコピーする
|
||||
// アーカイブはマウント済みにしておく
|
||||
bool ExportTwlSaveFile(const wchar_t* from_path, const wchar_t* to_path, void* buf, const size_t bufSize,
|
||||
nn::fs::FileOutputStream* list, nn::crypto::Sha256Context* listContext);
|
||||
|
||||
// ディレクトリ間のコピー
|
||||
// アーカイブ越しのコピーが可能
|
||||
// アーカイブにマウントした状態で呼び出す必要あり
|
||||
// 書き込み先のディレクトリはあらかじめ消去しておくこと。
|
||||
// 引数はスラッシュ付き
|
||||
// TODO:分割して短くする
|
||||
bool CopyDirectory(ImportDataList* fileList, const wchar_t * from_path, const wchar_t * to_path, void* buf,
|
||||
const size_t bufSize, bool encode, nn::fs::FileOutputStream* list, nn::crypto::Sha256Context* listContext);
|
||||
|
||||
// ファイル転送の進捗を取得する
|
||||
// InitializeTransferProgress で設定した値を100とする割合が返される
|
||||
u32 GetProgress();
|
||||
|
||||
// ファイル転送の目標値を設定する
|
||||
void InitializeTransferProgress(u64 totalSize);
|
||||
|
||||
// wchar_t* を char* に変換する。
|
||||
// 内部のバッファを使用するためスレッドアンセーフ
|
||||
const char* GetCharStr(const wchar_t* path);
|
||||
|
||||
}
|
||||
|
||||
@ -34,11 +34,22 @@ public:
|
||||
|
||||
void Initialize(u32 width, u32 height, u32 maxLine, demo::RenderSystemDrawing* renderSystem);
|
||||
|
||||
// コンソールに描画する文字列を追加する
|
||||
void AddText(const char* fmt, ::std::va_list arg);
|
||||
|
||||
// 上スクロールする
|
||||
void ScrollUp();
|
||||
|
||||
// 下スクロールする
|
||||
void ScrollDown();
|
||||
|
||||
// 先頭にスクロールする
|
||||
void ScrollToBegin();
|
||||
|
||||
// 末尾にスクロールする
|
||||
void ScrollToEnd();
|
||||
|
||||
// AddTextで追加された文字列を描画する
|
||||
void Print();
|
||||
|
||||
private:
|
||||
|
||||
@ -21,9 +21,16 @@
|
||||
namespace common
|
||||
{
|
||||
|
||||
// ResFontを初期化する。
|
||||
void InitializeResFont();
|
||||
void DrawResFont(s32 display);
|
||||
|
||||
// 文字列の描画時に実行したいハンドラを設定する
|
||||
void SetDrawTextHandler(void (*func)());
|
||||
|
||||
// SetDrawTextHandler で設定した関数を使って文字列を描画する
|
||||
void DrawResFont(s32 display);
|
||||
|
||||
// 内部で保持しているTextWriterへのポインタを返す
|
||||
nn::font::TextWriter* GetTextWriter();
|
||||
|
||||
|
||||
|
||||
@ -30,8 +30,13 @@ public:
|
||||
SdLogger();
|
||||
~SdLogger() {};
|
||||
|
||||
// SDログに文字列を出力する
|
||||
void Print(const char* fmt, ::std::va_list arg);
|
||||
|
||||
// SDログを削除する
|
||||
void Clear();
|
||||
|
||||
// 内部状態を初期化する。SDカード挿抜時に呼ばれることを期待
|
||||
void Inactivate();
|
||||
|
||||
private:
|
||||
@ -44,11 +49,16 @@ private:
|
||||
|
||||
};
|
||||
|
||||
// SDカード挿抜用のスレッドを初期化する
|
||||
void InitializeEjectThread();
|
||||
|
||||
// SDカードが抜けた時に呼ばれるコールバック
|
||||
void SetEjectHandler(void (*func)());
|
||||
|
||||
// SDカードが挿入された時に呼ばれるコールバック
|
||||
void SetInsertHandler(void (*func)());
|
||||
|
||||
// 内部で保持しているインスタンスへのポインタを返す
|
||||
SdLogger* GetSdInstance();
|
||||
|
||||
} // namespace Logger
|
||||
|
||||
@ -181,9 +181,9 @@ void InitializeSimplePlayer()
|
||||
threadSound.Start(SoundThreadFunc, s_SoundThreadStack);
|
||||
}
|
||||
|
||||
void PlaySound(u8 index)
|
||||
void PlaySound(SoundEffect index)
|
||||
{
|
||||
NN_ASSERT(index <= nFiles);
|
||||
NN_ASSERT(index < SOUND_MAX);
|
||||
|
||||
while(!s_SoundThreadInitialized)
|
||||
{
|
||||
|
||||
@ -19,19 +19,26 @@
|
||||
namespace common
|
||||
{
|
||||
|
||||
enum SoundEffect
|
||||
typedef enum SoundEffect
|
||||
{
|
||||
SOUND_OK,
|
||||
SOUND_NG,
|
||||
SOUND_CURSOR,
|
||||
SOUND_ANNOTATION
|
||||
};
|
||||
SOUND_ANNOTATION,
|
||||
SOUND_MAX
|
||||
|
||||
} SoundEffect;
|
||||
|
||||
// サウンドを鳴らすための初期化を行う
|
||||
void InitializeSimplePlayer();
|
||||
void FinalizeSimplePlayer();
|
||||
void PlaySound(u8 index);
|
||||
|
||||
} // namespace ConsoleBackup
|
||||
// 終了処理を行う
|
||||
void FinalizeSimplePlayer();
|
||||
|
||||
// サウンドを鳴らす
|
||||
void PlaySound(SoundEffect index);
|
||||
|
||||
} // namespace common
|
||||
|
||||
|
||||
#endif /* SIMPLEPLAYER_H_ */
|
||||
|
||||
@ -36,28 +36,70 @@ public:
|
||||
void Initialize();
|
||||
void Finalize();
|
||||
|
||||
// シリアルナンバーにモジュラス10 ウェイト3・1(M10W31)でチェックデジットを付加する
|
||||
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();
|
||||
|
||||
// バッテリ残量を0~100で返す
|
||||
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);
|
||||
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
namespace common
|
||||
{
|
||||
|
||||
// リージョンコードに基づいてバージョン情報を取得する
|
||||
void GetSystemVersion(common::VerDef* mVerData, nn::cfg::CTR::CfgRegionCode region);
|
||||
|
||||
}
|
||||
|
||||
@ -60,6 +60,7 @@ struct VerDef
|
||||
nn::pl::CTR::NetworkUpdateVersion nup;
|
||||
};
|
||||
|
||||
// CALに依存するCFGパラメータ
|
||||
struct CfgCalData
|
||||
{
|
||||
nn::cfg::CTR::detail::TouchPanelCfgData touchPanelCfgData;
|
||||
@ -89,6 +90,7 @@ const nn::ProgramId cNupVerId[] =
|
||||
nn::pl::CTR::SHAREDDATA_TITLEID_NUP_VERSION_EU,
|
||||
};
|
||||
|
||||
// SDに出力するデータのヘッダ
|
||||
struct BackupDataHeader
|
||||
{
|
||||
s64 size; // パディングを含まないファイルサイズ
|
||||
@ -96,6 +98,7 @@ struct BackupDataHeader
|
||||
NN_PADDING4;
|
||||
};
|
||||
|
||||
// SDから読み込むファイルリストのエントリ
|
||||
struct ImportDataEntry
|
||||
{
|
||||
std::string fileName;
|
||||
@ -105,6 +108,7 @@ struct ImportDataEntry
|
||||
|
||||
typedef std::vector<common::ImportDataEntry> ImportDataList;
|
||||
|
||||
// TWLセーブデータリストのエントリ
|
||||
struct SavePathInfo
|
||||
{
|
||||
std::wstring name;
|
||||
|
||||
@ -98,7 +98,7 @@ void ExporterTest::ExportTwlSaveData()
|
||||
NN_LOG("WriteTwlTitleData\n");
|
||||
ConsoleBackup::ExportTwlSaveData();
|
||||
|
||||
while (!ConsoleBackup::IsExportFinished())
|
||||
while (!ConsoleBackup::IsExportThreadFinished())
|
||||
{
|
||||
nn::os::Thread::Sleep(nn::fnd::TimeSpan::FromMilliSeconds(10));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user