From 5bf7a9fd2eaf2cfeedb7572a225f5624374a0ffb Mon Sep 17 00:00:00 2001 From: kamikawa Date: Thu, 10 Jul 2008 10:17:03 +0000 Subject: [PATCH] =?UTF-8?q?ImportJump=20=20=20=20:=20=E3=80=8CPrivate?= =?UTF-8?q?=E3=82=BB=E3=83=BC=E3=83=96=E3=83=87=E3=83=BC=E3=82=BF=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92=E3=82=AF=E3=83=AA=E3=82=A2?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=80=8D=E3=81=8C=E3=83=81=E3=82=A7=E3=83=83?= =?UTF-8?q?=E3=82=AF=E3=81=95=E3=82=8C=E3=81=A6=E3=81=84=E3=81=9F=E5=A0=B4?= =?UTF-8?q?=E5=90=88=E3=81=ABpublic=E3=82=92=E3=82=AF=E3=83=AA=E3=82=A2?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=81=84=E3=81=9F=E4=B8=8D=E5=85=B7=E5=90=88?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82=20SystemUpdater=20:=20IS-T?= =?UTF-8?q?WL-DEBUGGER=E3=81=A7=E3=81=AE=E5=AE=9F=E8=A1=8C=E4=B8=AD?= =?UTF-8?q?=E3=81=AB=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=82=92=E5=88=B6=E5=BE=A1=E3=81=99=E3=82=8B=E4=BB=95?= =?UTF-8?q?=E7=B5=84=E3=81=BF=E3=82=92=E8=BF=BD=E5=8A=A0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1843 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- .../ImportJump/ARM9.TWL/src/import.c | 4 +- .../SystemUpdater/ARM9.TWL/Makefile | 3 +- .../SystemUpdater/ARM9.TWL/include/import.h | 1 - .../SystemUpdater/ARM9.TWL/src/import.c | 40 ------ .../SystemUpdater/ARM9.TWL/src/main.c | 120 +++++++++++++++++- .../ARM9/src/debugger_hw_reset_control.c | 2 +- 6 files changed, 119 insertions(+), 51 deletions(-) diff --git a/build/systemMenu_tools/ImportJump/ARM9.TWL/src/import.c b/build/systemMenu_tools/ImportJump/ARM9.TWL/src/import.c index 3a4481ea..52be8ceb 100644 --- a/build/systemMenu_tools/ImportJump/ARM9.TWL/src/import.c +++ b/build/systemMenu_tools/ImportJump/ARM9.TWL/src/import.c @@ -170,6 +170,8 @@ BOOL kamiImportTad(NAMTitleId* pTitleID) } else { + kamiFontPrintfMain( 4, 20, 1, "Import was failed! 0x%x", nam_result); + kamiFontLoadScreenData(); OS_Warning(" Fail! : NAM Result Code = 0x%x\n", nam_result); return FALSE; } @@ -197,7 +199,7 @@ BOOL kamiImportTad(NAMTitleId* pTitleID) // privateセーブデータFFクリア&フォーマット if (GetImportJumpSetting()->clearPrivateSaveData && tadInfo.titleInfo.privateSaveSize > 0) { - if (NAMUTi_ClearSavedataPublic(savePrivatePath, tadInfo.titleInfo.titleId) == FALSE) + if (NAMUTi_ClearSavedataPrivate(savePrivatePath, tadInfo.titleInfo.titleId) == FALSE) { OS_Warning(" Fail! NAMUTi_ClearSavedataPrivate\n"); } diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/Makefile b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/Makefile index c09900e4..5e84a03a 100644 --- a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/Makefile +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/Makefile @@ -53,7 +53,8 @@ SRCS = main.c \ hw_info.c \ keypad.c \ kami_copy_file.c \ - debugger_hw_reset_control.c + debugger_hw_reset_control.c \ + debugger_card_rom.c LINCLUDES = include \ ../common/include \ diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/import.h b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/import.h index bb4b840b..8c04f1f6 100644 --- a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/import.h +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/import.h @@ -35,7 +35,6 @@ extern "C" { *---------------------------------------------------------------------------*/ s32 kamiImportTad(int no, int total, const char* path); -void DrawResult(BOOL result); /*===========================================================================*/ diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/import.c b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/import.c index 357c7198..b422e173 100644 --- a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/import.c +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/import.c @@ -192,43 +192,3 @@ void ProgressDraw(f32 ratio) // 3Dスワップ G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); } - -/*---------------------------------------------------------------------------* - Name: DrawResult - - Description: 処理結果を表示します。 - - Arguments: - - Returns: None. - *---------------------------------------------------------------------------*/ - -void DrawResult(BOOL result) -{ - // 3D初期化 - G3X_Reset(); - G3_Identity(); - G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); - - // "Now Updating.." を消去 - kamiFontPrintfMain( 0, 9, 7, " "); - - if (result) - { - kamiFontPrintfMain( 9, 10, 7, "Update Success!"); - // グリーンダイアログ - DrawQuad( 50, 50, 206, 120, GX_RGB(12, 25, 12)); - } - else - { - kamiFontPrintfMain( 9, 10, 7, "Update Failure!"); - // レッドダイアログ - DrawQuad( 50, 50, 206, 120, GX_RGB(31, 0, 0)); - } - - kamiFontLoadScreenData(); - - // 3Dスワップ - G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); -} - diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/main.c b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/main.c index 5ed6a061..06dbd365 100644 --- a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/main.c +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/main.c @@ -31,6 +31,7 @@ #include "hwi.h" #include "keypad.h" #include "debugger_hw_reset_control.h" +#include "debugger_card_rom.h" extern const char *g_strIPLSvnRevision; extern const char *g_strSDKSvnRevision; @@ -87,6 +88,7 @@ static NAMTitleId titleId; static s16 printLine; static vu8 sIsFormatFinish; static u8 sFormatResult; +static s32 sLockId; /*---------------------------------------------------------------------------* 内部関数定義 @@ -95,7 +97,9 @@ static void VBlankIntr(void); static void InitAllocation(void); static BOOL IgnoreRemoval(void); static void DrawWaitButtonA(void); +static void DrawCancel(void); static void DrawAlready(SystemUpdaterLog* log); +static void DrawResult(BOOL result); static void FormatCallback(KAMIResult result, void* arg); /*---------------------------------------------------------------------------* @@ -159,6 +163,9 @@ TwlMain() InitGraphics(); kamiFontInit(); + // メインスレッドのカードロックID取得 + sLockId = OS_GetLockID(); + /* always preload FS table for faster directory access. */ { u32 need_size = FS_GetTableSize(); @@ -212,10 +219,14 @@ TwlMain() } } - // Aボタン待ち DrawWaitButtonA(); + // TWLの更新処理を実行中です + CARD_LockRom((u16)sLockId); + (void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_NOW_UPDATE); + CARD_UnlockRom((u16)sLockId); + // ISデバッガのハードウェアリセットを禁止する DEBUGGER_HwResetDisable(); @@ -376,6 +387,11 @@ TwlMain() // ISデバッガのハードウェアリセットを許可する DEBUGGER_HwResetEnable(); + // TWLの更新処理が完了しました + CARD_LockRom((u16)sLockId); + (void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_FINISHED); + CARD_UnlockRom((u16)sLockId); + // 結果表示 while(1) { @@ -434,14 +450,20 @@ static void InitAllocation(void) *---------------------------------------------------------------------------*/ static void DrawWaitButtonA(void) { + // 液晶を見てください。 + CARD_LockRom((u16)sLockId); + (void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_LOOK_SCREEN); + CARD_UnlockRom((u16)sLockId); + kamiFontPrintfMain( 5, 3, 8, " System Updater "); kamiFontPrintfMain( 4, 5, 8, " --- ver %s %s ---", g_strSDKSvnRevision, g_strIPLSvnRevision ); - kamiFontPrintfMain( 5, 8, 3, ""); - kamiFontPrintfMain( 3, 10, 1, "--------------------------"); - kamiFontPrintfMain( 3, 11, 1, "Do not turn off power"); - kamiFontPrintfMain( 3, 12, 1, "while update is processing"); - kamiFontPrintfMain( 3, 13, 1, "--------------------------"); + kamiFontPrintfMain( 5, 9, 3, " A Button: Start Update "); + kamiFontPrintfMain( 5, 10, 3, " B Button: Cancel Update "); + + kamiFontPrintfMain( 3, 13, 1, "Do not turn off power"); + kamiFontPrintfMain( 3, 14, 1, "while update is processing"); + while(1) { @@ -449,7 +471,7 @@ static void DrawWaitButtonA(void) G3_Identity(); G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); - DrawQuad( 10, 54, 246, 120, GX_RGB(28, 28, 28)); + DrawQuad( 10, 54, 246, 150, GX_RGB(28, 28, 28)); G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); @@ -459,6 +481,12 @@ static void DrawWaitButtonA(void) kamiFontClearMain(); break; } + else if (kamiPadIsTrigger(PAD_BUTTON_B)) + { + kamiFontClearMain(); + DrawCancel(); + } + OS_WaitVBlankIntr(); } @@ -467,6 +495,41 @@ static void DrawWaitButtonA(void) OS_WaitVBlankIntr(); } + +/*---------------------------------------------------------------------------* + Name: DrawCancel + + Description: Cancelを表示します + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +static void DrawCancel(void) +{ + // キャンセルされました + CARD_LockRom((u16)sLockId); + (void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_CANCELED); + CARD_UnlockRom((u16)sLockId); + + kamiFontPrintfMain( 3, 9, 1, "--------------------------"); + kamiFontPrintfMain( 3, 10, 1, " Update was Canceld."); + kamiFontPrintfMain( 3, 11, 1, "--------------------------"); + + while(1) + { + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + + DrawQuad( 10, 50, 246, 128, GX_RGB(28, 28, 28)); + + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + + OS_WaitVBlankIntr(); + } +} + /*---------------------------------------------------------------------------* Name: DrawAlready @@ -478,6 +541,11 @@ static void DrawWaitButtonA(void) *---------------------------------------------------------------------------*/ static void DrawAlready(SystemUpdaterLog* log) { + // 既にアップデート済み + CARD_LockRom((u16)sLockId); + (void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_ALREADY); + CARD_UnlockRom((u16)sLockId); + kamiFontPrintfMain( 3, 8, 1, "--------------------------"); kamiFontPrintfMain( 3, 9, 1, "This machine has already"); kamiFontPrintfMain( 3, 10, 1, "been updated."); @@ -498,6 +566,44 @@ static void DrawAlready(SystemUpdaterLog* log) } } +/*---------------------------------------------------------------------------* + Name: DrawResult + + Description: 処理結果を表示します。 + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +static void DrawResult(BOOL result) +{ + // 3D初期化 + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + + // "Now Updating.." を消去 + kamiFontPrintfMain( 0, 9, 7, " "); + + if (result) + { + kamiFontPrintfMain( 9, 10, 7, "Update Success!"); + // グリーンダイアログ + DrawQuad( 50, 50, 206, 120, GX_RGB(12, 25, 12)); + } + else + { + kamiFontPrintfMain( 9, 10, 7, "Update Failure!"); + // レッドダイアログ + DrawQuad( 50, 50, 206, 120, GX_RGB(31, 0, 0)); + } + + kamiFontLoadScreenData(); + + // 3Dスワップ + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); +} + /*---------------------------------------------------------------------------* Name: FormatCallback diff --git a/build/systemMenu_tools/common/ARM9/src/debugger_hw_reset_control.c b/build/systemMenu_tools/common/ARM9/src/debugger_hw_reset_control.c index 7868c923..abe3f114 100644 --- a/build/systemMenu_tools/common/ARM9/src/debugger_hw_reset_control.c +++ b/build/systemMenu_tools/common/ARM9/src/debugger_hw_reset_control.c @@ -35,7 +35,7 @@ vu8 sHwResetEnable = TRUE; OSThread sThread; u32 sStack[1024]; -s32 sLockId; +static s32 sLockId; /*---------------------------------------------------------------------------* 関数宣言