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@610 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
9b53c578c8
commit
8106990361
@ -56,24 +56,8 @@ bool s_SkipNupMode = false;
|
||||
// プリインストール書き込みモードかどうか
|
||||
bool s_DownloadPreinstallMode = false;
|
||||
|
||||
// APSettingの書式が無い警告サウンドを鳴らしたかどうか
|
||||
bool s_ExistAPSettingAnnotation = false;
|
||||
// APSettingの書式が違っている警告サウンドを鳴らしたかどうか
|
||||
bool s_APSettingAnnotation = false;
|
||||
// シリアルナンバーがない警告サウンドを鳴らしたかどうか
|
||||
bool s_SerialNumberAnnotation = false;
|
||||
// 失敗サウンドを鳴らしたかどうか
|
||||
bool s_PlayedFailSound = false;
|
||||
// 操作開始サウンドを鳴らしたかどうか
|
||||
bool s_PlayedStartCursor = false;
|
||||
// リブート開始前サウンドを鳴らしたかどうか
|
||||
bool s_PlayedRebootCursor = false;
|
||||
// SD抜き出し前サウンドを鳴らしたかどうか
|
||||
bool s_PlayedSdPullOutCursor = false;
|
||||
// SDに書き込みできない警告サウンドを鳴らしたかどうか
|
||||
bool s_SdWriteProetctAnnotation = false;
|
||||
// WiFiがOFFである警告サウンドを鳴らしたかどうか
|
||||
bool s_WifiStatusOffAnnotation = false;
|
||||
|
||||
// ネットワークアップデートを開始したかどうか
|
||||
bool s_ExecuteFgNup = false;
|
||||
@ -172,9 +156,43 @@ typedef enum RestoreState
|
||||
PREINSTALL_DOWNLOAD_APP, // アプリダウンロード
|
||||
PREINSTALL_DOWNLOAD_APP_NOT_ENOUGH_SPACE, // アプリダウンロード失敗、空き容量不足
|
||||
PREINSTALL_WAIT_USER_SD_EJECT, // ユーザSD抜き出し待ち
|
||||
PREINSTALL_CHECK_REPAIR_SD // 修理用SDのチェック
|
||||
PREINSTALL_CHECK_REPAIR_SD, // 修理用SDのチェック
|
||||
|
||||
RESTORE_STATE_MAX
|
||||
} RestoreState;
|
||||
|
||||
enum AnnotationSound
|
||||
{
|
||||
ANNOTATION_SD_WRITE_PROTECT,
|
||||
ANNOTATION_WIFI_OFF,
|
||||
ANNOTATION_SETTING_NOT_FOUND,
|
||||
ANNOTATION_INVALID_SETTING,
|
||||
ANNOTATION_SERIAL_NUMBER_NOT_IN_SD,
|
||||
|
||||
ANNOTATION_MAX
|
||||
};
|
||||
|
||||
bool s_PlayedCursorSound[RESTORE_STATE_MAX];
|
||||
bool s_PlayedAnnotationSound[ANNOTATION_MAX];
|
||||
|
||||
void PlayCursorSound(RestoreState state)
|
||||
{
|
||||
if(!s_PlayedCursorSound[state])
|
||||
{
|
||||
common::PlaySound(common::SOUND_CURSOR);
|
||||
s_PlayedCursorSound[state] = true;
|
||||
}
|
||||
}
|
||||
|
||||
void PlayAnnotationSound(AnnotationSound index)
|
||||
{
|
||||
if(!s_PlayedAnnotationSound[index])
|
||||
{
|
||||
common::PlaySound(common::SOUND_ANNOTATION);
|
||||
s_PlayedAnnotationSound[index] = true;
|
||||
}
|
||||
}
|
||||
|
||||
#define BREAK_IF_STATE_CHANGED(saved, current) \
|
||||
if(saved != current) \
|
||||
{\
|
||||
@ -188,6 +206,7 @@ void ChangeState(RestoreState saved, RestoreState& current, RestoreState next)
|
||||
if(saved == current)
|
||||
{
|
||||
current = next;
|
||||
s_PlayedCursorSound[next] = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -250,11 +269,7 @@ void CheckSdWritable(common::HardwareStateManager& manager, ::std::vector<std::s
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!s_SdWriteProetctAnnotation)
|
||||
{
|
||||
s_SdWriteProetctAnnotation = true;
|
||||
common::PlaySound(common::SOUND_ANNOTATION);
|
||||
}
|
||||
PlayAnnotationSound(ANNOTATION_SD_WRITE_PROTECT);
|
||||
message.push_back(::std::string("Can't Write SD Card!!\n"));
|
||||
s_RestoreState = STARTUP;
|
||||
}
|
||||
@ -307,12 +322,7 @@ void CheckNupExecuted(common::HardwareStateManager& manager, ::std::vector<std::
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!s_WifiStatusOffAnnotation)
|
||||
{
|
||||
s_WifiStatusOffAnnotation = true;
|
||||
common::PlaySound(common::SOUND_ANNOTATION);
|
||||
}
|
||||
|
||||
PlayAnnotationSound(ANNOTATION_WIFI_OFF);
|
||||
message.push_back(::std::string("Wireless is Off\n"));
|
||||
s_RestoreState = STARTUP;
|
||||
}
|
||||
@ -407,11 +417,7 @@ void CheckWriteFinished(common::HardwareStateManager& manager, ::std::vector<std
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!s_WifiStatusOffAnnotation)
|
||||
{
|
||||
s_WifiStatusOffAnnotation = true;
|
||||
common::PlaySound(common::SOUND_ANNOTATION);
|
||||
}
|
||||
PlayAnnotationSound(ANNOTATION_WIFI_OFF);
|
||||
message.push_back(::std::string("Wireless is Off\n"));
|
||||
}
|
||||
}
|
||||
@ -717,11 +723,7 @@ bool CheckAndReadAPSetting(::std::vector<std::string>& operationMessage)
|
||||
|
||||
if (!ExistsAPSetting())
|
||||
{
|
||||
if(!s_ExistAPSettingAnnotation)
|
||||
{
|
||||
s_ExistAPSettingAnnotation = true;
|
||||
common::PlaySound(common::SOUND_ANNOTATION);
|
||||
}
|
||||
PlayAnnotationSound(ANNOTATION_SETTING_NOT_FOUND);
|
||||
operationMessage.push_back(::std::string("Accsess_Point_Setting does not exist!"));
|
||||
return false;
|
||||
}
|
||||
@ -771,11 +773,7 @@ bool CheckAndReadAPSetting(::std::vector<std::string>& operationMessage)
|
||||
if (!s_ReadSettingIsSuccess)
|
||||
{
|
||||
operationMessage.push_back(::std::string("Invalid Accsess_Point_Setting format!"));
|
||||
if(!s_APSettingAnnotation)
|
||||
{
|
||||
s_APSettingAnnotation = true;
|
||||
common::PlaySound(common::SOUND_ANNOTATION);
|
||||
}
|
||||
PlayAnnotationSound(ANNOTATION_INVALID_SETTING);
|
||||
}
|
||||
|
||||
return s_ReadSettingIsSuccess;
|
||||
@ -862,11 +860,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
{
|
||||
operationMessage.push_back(::std::string("Push A or START Button"));
|
||||
operationMessage.push_back(::std::string("Network Update Mode"));
|
||||
if (!s_PlayedStartCursor)
|
||||
{
|
||||
PlaySound(SOUND_CURSOR);
|
||||
s_PlayedStartCursor = true;
|
||||
}
|
||||
PlayCursorSound(WAIT_START_UPDATE);
|
||||
|
||||
if (nextStep)
|
||||
{
|
||||
@ -895,11 +889,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
|
||||
operationMessage.push_back(::std::string("Push A or START Button"));
|
||||
operationMessage.push_back(::std::string("Import Data Mode"));
|
||||
if (!s_PlayedStartCursor)
|
||||
{
|
||||
PlaySound(SOUND_CURSOR);
|
||||
s_PlayedStartCursor = true;
|
||||
}
|
||||
PlayCursorSound(WAIT_START_IMPORT);
|
||||
|
||||
if (nextStep)
|
||||
{
|
||||
@ -912,11 +902,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
{
|
||||
operationMessage.push_back(::std::string("Push A or START Button"));
|
||||
operationMessage.push_back(::std::string("DownLoad Twl Title and Clock Sync Mode"));
|
||||
if (!s_PlayedStartCursor)
|
||||
{
|
||||
PlaySound(SOUND_CURSOR);
|
||||
s_PlayedStartCursor = true;
|
||||
}
|
||||
PlayCursorSound(WAIT_START_SYNC_CLOCK);
|
||||
|
||||
if (nextStep)
|
||||
{
|
||||
@ -974,11 +960,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
operationMessage.push_back(::std::string("Push A or START Button"));
|
||||
operationMessage.push_back(::std::string("Import Data Mode"));
|
||||
|
||||
if (!s_SerialNumberAnnotation)
|
||||
{
|
||||
s_SerialNumberAnnotation = true;
|
||||
PlaySound(SOUND_ANNOTATION);
|
||||
}
|
||||
PlayAnnotationSound(ANNOTATION_SERIAL_NUMBER_NOT_IN_SD);
|
||||
|
||||
if (nextStep)
|
||||
{
|
||||
@ -999,12 +981,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
{
|
||||
operationMessage.push_back(::std::string("Network Update Done."));
|
||||
operationMessage.push_back(::std::string("Press A or START Button to Reboot"));
|
||||
|
||||
if (!s_PlayedRebootCursor)
|
||||
{
|
||||
PlaySound(SOUND_CURSOR);
|
||||
s_PlayedRebootCursor = true;
|
||||
}
|
||||
PlayCursorSound(UPDATE_DONE);
|
||||
|
||||
if (nextStep)
|
||||
{
|
||||
@ -1025,12 +1002,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
{
|
||||
operationMessage.push_back(::std::string("Get SDCI Done."));
|
||||
operationMessage.push_back(::std::string("Press A or START Button to Reboot"));
|
||||
|
||||
if (!s_PlayedRebootCursor)
|
||||
{
|
||||
PlaySound(SOUND_CURSOR);
|
||||
s_PlayedRebootCursor = true;
|
||||
}
|
||||
PlayCursorSound(DOWNLOAD_IVS_DONE);
|
||||
|
||||
if (nextStep)
|
||||
{
|
||||
@ -1097,11 +1069,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
|
||||
operationMessage.push_back(::std::string("Push A or START Button"));
|
||||
operationMessage.push_back(::std::string("Transfer Account Mode"));
|
||||
if (!s_PlayedStartCursor)
|
||||
{
|
||||
PlaySound(SOUND_CURSOR);
|
||||
s_PlayedStartCursor = true;
|
||||
}
|
||||
PlayCursorSound(WAIT_START_TRANSFER_ACCOUNT);
|
||||
|
||||
if (nextStep)
|
||||
{
|
||||
@ -1122,11 +1090,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
{
|
||||
operationMessage.push_back(::std::string("Push A or START Button"));
|
||||
operationMessage.push_back(::std::string("Delete Account Mode"));
|
||||
if (!s_PlayedStartCursor)
|
||||
{
|
||||
PlaySound(SOUND_CURSOR);
|
||||
s_PlayedStartCursor = true;
|
||||
}
|
||||
PlayCursorSound(WAIT_START_DELETE_ACCOUNT);
|
||||
|
||||
if (nextStep)
|
||||
{
|
||||
@ -1167,12 +1131,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
operationMessage.push_back(::std::string("Operate BMS."));
|
||||
operationMessage.push_back(::std::string(""));
|
||||
operationMessage.push_back(::std::string("Press A or START Button to Continue"));
|
||||
|
||||
if (!s_PlayedRebootCursor)
|
||||
{
|
||||
PlaySound(SOUND_CURSOR);
|
||||
s_PlayedRebootCursor = true;
|
||||
}
|
||||
PlayCursorSound(DELETE_ACCOUNT_DONE);
|
||||
|
||||
if (nextStep)
|
||||
{
|
||||
@ -1363,12 +1322,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
{
|
||||
operationMessage.push_back(::std::string("Restore Done."));
|
||||
operationMessage.push_back(::std::string("Press A or START Button to Reboot"));
|
||||
|
||||
if (!s_PlayedRebootCursor)
|
||||
{
|
||||
PlaySound(SOUND_CURSOR);
|
||||
s_PlayedRebootCursor = true;
|
||||
}
|
||||
PlayCursorSound(RESTORE_DONE);
|
||||
|
||||
if (nextStep)
|
||||
{
|
||||
@ -1550,12 +1504,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
{
|
||||
operationMessage.push_back(::std::string("ALL Done. Pull Out SD Card."));
|
||||
// SDカード抜けのみで次の状態に遷移する
|
||||
|
||||
if (!s_PlayedSdPullOutCursor)
|
||||
{
|
||||
common::PlaySound(common::SOUND_CURSOR);
|
||||
s_PlayedSdPullOutCursor = true;
|
||||
}
|
||||
PlayCursorSound(WAIT_SD_EJECT);
|
||||
|
||||
}
|
||||
break;
|
||||
@ -1596,13 +1545,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
case NUP_ONLY_WAIT_SD_EJECT:
|
||||
{
|
||||
operationMessage.push_back(::std::string("Update Done. Pull Out SD Card."));
|
||||
|
||||
// SDカード抜けのみで次の状態に遷移する
|
||||
if (!s_PlayedSdPullOutCursor)
|
||||
{
|
||||
common::PlaySound(common::SOUND_CURSOR);
|
||||
s_PlayedSdPullOutCursor = true;
|
||||
}
|
||||
PlayCursorSound(NUP_ONLY_WAIT_SD_EJECT);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1644,6 +1587,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
case PREINSTALL_WAIT_SYNC_TICKET:
|
||||
{
|
||||
operationMessage.push_back(::std::string("Press A or START Button to Continue."));
|
||||
PlayCursorSound(PREINSTALL_WAIT_SYNC_TICKET);
|
||||
if(nextStep)
|
||||
{
|
||||
s_RestoreState = SYNC_TICKET;
|
||||
@ -1653,6 +1597,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
|
||||
case PREINSTALL_WAIT_USER_SD_INSERT:
|
||||
{
|
||||
PlayCursorSound(PREINSTALL_WAIT_USER_SD_INSERT);
|
||||
operationMessage.push_back(::std::string("Insert User's SD Card"));
|
||||
}
|
||||
break;
|
||||
@ -1756,6 +1701,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
|
||||
case PREINSTALL_CHECK_SD_FAIL:
|
||||
{
|
||||
PlayCursorSound(PREINSTALL_CHECK_SD_FAIL);
|
||||
operationMessage.push_back(::std::string("Check User's SD Card Failed."));
|
||||
operationMessage.push_back(::std::string("Pull Out User's SD Card"));
|
||||
operationMessage.push_back(::std::string("and Insert Repairing SD Card"));
|
||||
@ -1842,6 +1788,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
|
||||
case PREINSTALL_DOWNLOAD_APP_NOT_ENOUGH_SPACE:
|
||||
{
|
||||
PlayCursorSound(PREINSTALL_DOWNLOAD_APP_NOT_ENOUGH_SPACE);
|
||||
operationMessage.push_back(::std::string("Not enough space on User's SD Card"));
|
||||
operationMessage.push_back(::std::string("Pull out User's SD Card"));
|
||||
operationMessage.push_back(::std::string("and Insert Repairing SD Card"));
|
||||
@ -1850,6 +1797,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
|
||||
|
||||
case PREINSTALL_WAIT_USER_SD_EJECT:
|
||||
{
|
||||
PlayCursorSound(PREINSTALL_WAIT_USER_SD_EJECT);
|
||||
operationMessage.push_back(::std::string("Pull out User's SD Card"));
|
||||
operationMessage.push_back(::std::string("and Insert Repairing SD Card"));
|
||||
}
|
||||
@ -1981,23 +1929,25 @@ void InitializeState()
|
||||
s_ShopOperationRetryCount[i] = 0;
|
||||
}
|
||||
|
||||
for(u32 i = 0; i < RESTORE_STATE_MAX; i++)
|
||||
{
|
||||
s_PlayedCursorSound[i] = false;
|
||||
}
|
||||
|
||||
for(u32 i = 0; i < ANNOTATION_MAX; i++)
|
||||
{
|
||||
s_PlayedAnnotationSound[i] = false;
|
||||
}
|
||||
|
||||
common::InitializeFileCheck();
|
||||
|
||||
s_ExistAPSettingAnnotation = false;
|
||||
s_ReadSettingDone = false;
|
||||
s_ReadSettingIsSuccess = false;
|
||||
s_APSettingAnnotation = false;
|
||||
s_SerialNumberAnnotation = false;
|
||||
s_PlayedFailSound = false;
|
||||
s_ExecuteFgNup = false;
|
||||
s_FgNupRetryCount = 0;
|
||||
s_PlayedStartCursor = false;
|
||||
s_PlayedRebootCursor = false;
|
||||
s_PlayedSdPullOutCursor = false;
|
||||
s_NupOnlyMode = false;
|
||||
s_GetIvsOnlyMode = false;
|
||||
s_SdWriteProetctAnnotation = false;
|
||||
s_WifiStatusOffAnnotation = false;
|
||||
s_CheckSdOnlyMode = false;
|
||||
s_SkipNupMode = false;
|
||||
}
|
||||
@ -2018,7 +1968,7 @@ u32 GetProgress()
|
||||
{
|
||||
return GetUpdateProgress();
|
||||
}
|
||||
else if(s_RestoreState == DOWNLOAD_TWL)
|
||||
else if (s_RestoreState == DOWNLOAD_TWL || s_RestoreState == PREINSTALL_DOWNLOAD_APP)
|
||||
{
|
||||
return GetTitleDownloadProgress();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user