diff --git a/build/tests/TestComponent/ARM9.TWL/Makefile b/build/tests/TestComponent/ARM9.TWL/Makefile index 6f3e3072..755c4c59 100644 --- a/build/tests/TestComponent/ARM9.TWL/Makefile +++ b/build/tests/TestComponent/ARM9.TWL/Makefile @@ -53,11 +53,11 @@ TWL_ARCHGEN = LIMITED TITLEID_LO = 0NRA #TARGET_TAD = -TARGET_BIN = NandInitializerRed.srl +TARGET_BIN = TestComponent.srl LCFILE_SPEC = ARM9-TS.lsf ROM_SPEC = main.rsf -MAKEROM_ARM7_BASE = ../ARM7.TWL/bin/$(TWL_BUILDTYPE_ARM7)/armadillo +MAKEROM_ARM7_BASE = $(SYSMENU_COMPONENTSDIR)/armadillo_uji/$(TWL_BUILDTYPE_ARM7)/armadillo MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) SRCS = main.c \ @@ -66,23 +66,7 @@ SRCS = main.c \ graphics.c \ keypad.c \ kami_font.c \ - kami_write_nandfirm.c \ - cursor.c \ - process_format.c \ - process_topmenu.c \ - process_hw_info.c \ - process_eticket.c \ - process_import.c \ - process_nandfirm.c \ - process_norfirm.c \ - process_auto.c \ - process_fade.c \ - process_write_data.c \ - process_mcu.c \ - process_wireless_setting.c \ - hwi.c \ - debugger_hw_reset_control.c \ - sort_title.c + LINCLUDES = ../common/include \ $(ROOT)/build/libraries/lcfg/ARM9.TWL/include \ diff --git a/build/tests/TestComponent/ARM9.TWL/include/cursor.h b/build/tests/TestComponent/ARM9.TWL/include/cursor.h deleted file mode 100644 index 7af9f41a..00000000 --- a/build/tests/TestComponent/ARM9.TWL/include/cursor.h +++ /dev/null @@ -1,45 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: cursor.h - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef KAMI_CURSOR_H_ -#define KAMI_CURSOR_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ - -#include - -/*---------------------------------------------------------------------------* - 関数定義 - *---------------------------------------------------------------------------*/ - -void SetCursorPos(u16 x, u16 y); - -/*===========================================================================*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* KAMI_CURSOR_H_ */ - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/kami_write_nandfirm.h b/build/tests/TestComponent/ARM9.TWL/include/kami_write_nandfirm.h deleted file mode 100644 index 90fe68bd..00000000 --- a/build/tests/TestComponent/ARM9.TWL/include/kami_write_nandfirm.h +++ /dev/null @@ -1,52 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: kami_write_nandfirm.h - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef KAMI_WRITE_NAND_FIRM -#define KAMI_WRITE_NAND_FIRM - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ - -#include - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -typedef void* (*KAMIAlloc)(u32 size); -typedef void (*KAMIFree)(void* ptr); - -/*---------------------------------------------------------------------------* - 関数定義 - *---------------------------------------------------------------------------*/ - -BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFunc); - -/*===========================================================================*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* KAMI_WRITE_NAND_FIRM */ - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/process_auto.h b/build/tests/TestComponent/ARM9.TWL/include/process_auto.h deleted file mode 100644 index 7aeecf89..00000000 --- a/build/tests/TestComponent/ARM9.TWL/include/process_auto.h +++ /dev/null @@ -1,85 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_auto.h - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef AUTO_TOPMENU_H_ -#define AUTO_TOPMENU_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ - -#include - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -enum { - AUTO_PROCESS_MENU_FORMAT = 0, -#ifndef TWL_CAPTURE_VERSION - AUTO_PROCESS_MENU_HARDWARE_INFO, -#endif // TWL_CAPTURE_VERSION -#ifdef USE_WRITE_VARIOUS_DATA - AUTO_PROCESS_MENU_VARIOUS_DATA, -#endif // USE_WRITE_VARIOUS_DATA - AUTO_PROCESS_MENU_IMPORT_TAD, - AUTO_PROCESS_MENU_IMPORT_NANDFIRM, - AUTO_PROCESS_MENU_MCU, -#ifdef MARIOCLUB_VERSION - AUTO_PROCESS_MENU_MACHINE_INITIALIZE, -#endif // MARIOCLUB_VERSION - AUTO_PROCESS_MENU_NUM -}; - -typedef enum _AutoProcessResult -{ - AUTO_PROCESS_RESULT_SUCCESS, - AUTO_PROCESS_RESULT_FAILURE, - AUTO_PROCESS_RESULT_SKIP -} -AutoProcessResult; - -/*---------------------------------------------------------------------------* - グローバル変数定義 - *---------------------------------------------------------------------------*/ - -extern BOOL gAutoFlag; -extern AutoProcessResult gAutoProcessResult[AUTO_PROCESS_MENU_NUM]; - -/*---------------------------------------------------------------------------* - 関数定義 - *---------------------------------------------------------------------------*/ - -void* AutoProcess0(void); -void* AutoProcess1(void); -void* AutoProcess2(void); -void* AutoProcess3(void); -void* AutoProcess4(void); - -/*===========================================================================*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* AUTO_TOPMENU_H_ */ - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/process_eticket.h b/build/tests/TestComponent/ARM9.TWL/include/process_eticket.h deleted file mode 100644 index 16b81232..00000000 --- a/build/tests/TestComponent/ARM9.TWL/include/process_eticket.h +++ /dev/null @@ -1,55 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_eticket.h - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef PROCESS_ETICKET_H_ -#define PROCESS_ETICKET_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ - -#include - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ -#define E_TICKET_FILE_PATH_IN_ROM "rom:/data/cert.sys" -#define E_TICKET_FILE_PATH_IN_NAND "nand:sys/cert.sys" - -/*---------------------------------------------------------------------------* - 関数定義 - *---------------------------------------------------------------------------*/ - -void* eTicketProcess0(void); -void* eTicketProcess1(void); -void* eTicketProcess2(void); -void* eTicketProcess3(void); -void* eTicketProcess4(void); - -/*===========================================================================*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* PROCESS_ETICKET_H_ */ - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/process_fade.h b/build/tests/TestComponent/ARM9.TWL/include/process_fade.h deleted file mode 100644 index a1694237..00000000 --- a/build/tests/TestComponent/ARM9.TWL/include/process_fade.h +++ /dev/null @@ -1,59 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_fade.h - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef PROCESS_FADE_H_ -#define PROCESS_FADE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ - -#include - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ -typedef void* (*Process)(void); - -/*---------------------------------------------------------------------------* - マクロ定義 - *---------------------------------------------------------------------------*/ - -#define FADE_IN_RETURN(P) SetNextProcess(P);return fadeInProcess; -#define FADE_OUT_RETURN(P) SetNextProcess(P);return fadeOutProcess; - -/*---------------------------------------------------------------------------* - 関数定義 - *---------------------------------------------------------------------------*/ - -void* fadeInProcess(void); -void* fadeOutProcess(void); -void SetNextProcess(Process process); - -/*===========================================================================*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* PROCESS_FADE_H_ */ - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/process_format.h b/build/tests/TestComponent/ARM9.TWL/include/process_format.h deleted file mode 100644 index 507d198d..00000000 --- a/build/tests/TestComponent/ARM9.TWL/include/process_format.h +++ /dev/null @@ -1,55 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_format.h - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef PROCESS_FORMAT_H_ -#define PROCESS_FORMAT_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ - -#include - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -//typedef void* (*TpProcess)(void); - -/*---------------------------------------------------------------------------* - 関数定義 - *---------------------------------------------------------------------------*/ - -void* FormatProcess0(void); -void* FormatProcess1(void); -void* FormatProcess2(void); -void* FormatProcess3(void); -void* FormatProcess4(void); - -/*===========================================================================*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* PROCESS_FORMAT_H_ */ - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/process_hw_info.h b/build/tests/TestComponent/ARM9.TWL/include/process_hw_info.h deleted file mode 100644 index ea3508d4..00000000 --- a/build/tests/TestComponent/ARM9.TWL/include/process_hw_info.h +++ /dev/null @@ -1,67 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_hw_info.h - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef PROCESS_HW_INFO_H_ -#define PROCESS_HW_INFO_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ - -#include - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -//typedef void* (*TpProcess)(void); - -/*---------------------------------------------------------------------------* - 関数定義 - *---------------------------------------------------------------------------*/ - -void* HWInfoProcess0(void); -void* HWInfoProcess1(void); -void* HWInfoProcess2(void); -void* HWInfoProcess3(void); -void* HWInfoProcess4(void); - -/*---------------------------------------------------------------------------* - Name: HW情報全体のライト - - Description: - - Arguments: region : - wirelessForceOff : 無線強制OFFならTRUEを指定 - - Returns: None. - *---------------------------------------------------------------------------*/ -BOOL WriteHWInfoFile( u8 region, BOOL wirelessForceOff ); - -/*===========================================================================*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* PROCESS_HW_INFO_H_ */ - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/process_import.h b/build/tests/TestComponent/ARM9.TWL/include/process_import.h deleted file mode 100644 index 3f3a1f6f..00000000 --- a/build/tests/TestComponent/ARM9.TWL/include/process_import.h +++ /dev/null @@ -1,58 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_import.h - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef PROCESS_IMPORT_H_ -#define PROCESS_IMPORT_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ - -#include - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -//typedef void* (*TpProcess)(void); - -/*---------------------------------------------------------------------------* - 関数定義 - *---------------------------------------------------------------------------*/ - -void* ImportProcess0(void); -void* ImportProcess1(void); -void* ImportProcess2(void); -void* ImportProcess3(void); -void* ImportProcess4(void); - -void ProgressInit(void); -void ProgressDraw(f32 ratio); - -/*===========================================================================*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* PROCESS_IMPORT_H_ */ - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/process_mcu.h b/build/tests/TestComponent/ARM9.TWL/include/process_mcu.h deleted file mode 100644 index f68c6dfb..00000000 --- a/build/tests/TestComponent/ARM9.TWL/include/process_mcu.h +++ /dev/null @@ -1,53 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_mcu.h - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef PROCESS_MCU_H_ -#define PROCESS_MCU_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ - -#include - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - 関数定義 - *---------------------------------------------------------------------------*/ - -void* mcuProcess0(void); -void* mcuProcess1(void); -void* mcuProcess2(void); -void* mcuProcess3(void); -void* mcuProcess4(void); - -/*===========================================================================*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* PROCESS_MCU_H_ */ - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/process_nandfirm.h b/build/tests/TestComponent/ARM9.TWL/include/process_nandfirm.h deleted file mode 100644 index 62bbf06a..00000000 --- a/build/tests/TestComponent/ARM9.TWL/include/process_nandfirm.h +++ /dev/null @@ -1,55 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_nandfirm.h - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef PROCESS_NANDFIRM_H_ -#define PROCESS_NANDFIRM_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ - -#include - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -//typedef void* (*TpProcess)(void); - -/*---------------------------------------------------------------------------* - 関数定義 - *---------------------------------------------------------------------------*/ - -void* NandfirmProcess0(void); -void* NandfirmProcess1(void); -void* NandfirmProcess2(void); -void* NandfirmProcess3(void); -void* NandfirmProcess4(void); - -/*===========================================================================*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* PROCESS_NANDFIRM_H_ */ - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/process_norfirm.h b/build/tests/TestComponent/ARM9.TWL/include/process_norfirm.h deleted file mode 100644 index 6e05fbb5..00000000 --- a/build/tests/TestComponent/ARM9.TWL/include/process_norfirm.h +++ /dev/null @@ -1,55 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_norfirm.h - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef PROCESS_NORFIRM_H_ -#define PROCESS_NORFIRM_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ - -#include - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -//typedef void* (*TpProcess)(void); - -/*---------------------------------------------------------------------------* - 関数定義 - *---------------------------------------------------------------------------*/ - -void* NorfirmProcess0(void); -void* NorfirmProcess1(void); -void* NorfirmProcess2(void); -void* NorfirmProcess3(void); -void* NorfirmProcess4(void); - -/*===========================================================================*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* PROCESS_NORFIRM_H_ */ - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/process_topmenu.h b/build/tests/TestComponent/ARM9.TWL/include/process_topmenu.h deleted file mode 100644 index 36d00836..00000000 --- a/build/tests/TestComponent/ARM9.TWL/include/process_topmenu.h +++ /dev/null @@ -1,56 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_topmenu.h - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef PROCESS_TOPMENU_H_ -#define PROCESS_TOPMENU_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ - -#include - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -//typedef void* (*TpProcess)(void); - -/*---------------------------------------------------------------------------* - 関数定義 - *---------------------------------------------------------------------------*/ - -void* TopmenuProcess0(void); -void* TopmenuProcess1(void); -void* TopmenuProcess2(void); -void* TopmenuProcess3(void); -void* TopmenuProcess4(void); -void* TopmenuProcess5(void); - -/*===========================================================================*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* PROCESS_TOPMENU_H_ */ - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/process_wireless_setting.h b/build/tests/TestComponent/ARM9.TWL/include/process_wireless_setting.h deleted file mode 100644 index a3f9f8d8..00000000 --- a/build/tests/TestComponent/ARM9.TWL/include/process_wireless_setting.h +++ /dev/null @@ -1,53 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_wireless_setting.h - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef PROCESS_WIRELESS_SETTING_H_ -#define PROCESS_WIRELESS_SETTING_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ - -#include - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - 関数定義 - *---------------------------------------------------------------------------*/ - -void* WirelessSettingProcess0(void); -void* WirelessSettingProcess1(void); -void* WirelessSettingProcess2(void); -void* WirelessSettingProcess3(void); -void* WirelessSettingProcess4(void); - -/*===========================================================================*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* PROCESS_WIRELESS_SETTING_H_ */ - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/process_write_data.h b/build/tests/TestComponent/ARM9.TWL/include/process_write_data.h deleted file mode 100644 index 7edc18d2..00000000 --- a/build/tests/TestComponent/ARM9.TWL/include/process_write_data.h +++ /dev/null @@ -1,58 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_write_data.h - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef PROCESS_WRITE_DATA_H_ -#define PROCESS_WRITE_DATA_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ - -#include - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ -#define FONT_DATA_FILE_PATH_IN_NAND "nand:sys/TWLFontTable.dat" -#define WRAP_DATA_FILE_PATH_IN_NAND "nand:/shared2/launcher/wrap.bin" -#define DEVKP_DATA_FILE_PATH_IN_NAND "nand:/sys/dev.kp" -#define CERT_DATA_FILE_PATH_IN_ROM "rom:/data/cert.sys" -#define CERT_DATA_FILE_PATH_IN_NAND "nand:/sys/cert.sys" - -/*---------------------------------------------------------------------------* - 関数定義 - *---------------------------------------------------------------------------*/ - -void* WriteDataProcess0(void); -void* WriteDataProcess1(void); -void* WriteDataProcess2(void); -void* WriteDataProcess3(void); -void* WriteDataProcess4(void); - -/*===========================================================================*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* PROCESS_WRITE_DATA_H_ */ - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/sort_title.h b/build/tests/TestComponent/ARM9.TWL/include/sort_title.h deleted file mode 100644 index 50e1f415..00000000 --- a/build/tests/TestComponent/ARM9.TWL/include/sort_title.h +++ /dev/null @@ -1,100 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: sort_title.h - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -/* - -【つかいかた】 - -TitleID と パス文字列の先頭アドレス を TitleSortSet 構造体にセットして -TitleSortSet 構造体を SortTitle 関数に引き渡します。 - -パス文字列の実体は、適当にどこかに格納しておいて弄らないようにしてください。 -次に使用例を示します。 - - -【擬似コード】 - -#define FILE_NUM_MAX 256 // 手抜き -#define QSORT_BUF_SIZE ((8+1) * 8) // サイズは(log2(num)+1) * 8 bytes - - char sFilePath[FILE_NUM_MAX][FS_ENTRY_LONGNAME_MAX]; - TitleSortSet sTitleSortSet[FILE_NUM_MAX]; - FSDirectoryEntryInfo info[1]; - NAMTadInfo tadInfo; - char qsortBuf[QSORT_BUF_SIZE]; - - while (ファイル全部舐めるまで) - { - // 〜 info にファイル情報読み込み〜 - // 〜 tadInfo に tad 情報取得〜 - - STD_CopyString( sFilePath[ counter ], info->longname ); - sTitleSortSet[ counter ].titleID = tadInfo.titleInfo.titleId; - sTitleSortSet[ counter ].path = sFilePath[ counter ]; - - counter++; - } - - SortTitle( sTitleSortSet, counter, qsortBuf ); - - // ソート完了 - -*/ - -#ifndef TWL_SORT_TITLE_H_ -#define TWL_SORT_TITLE_H_ - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/*===========================================================================*/ - -typedef struct { - OSTitleId titleID; - char *path; -} TitleSortSet; - -// TitleSortSet の配列をある法則にしたがってソートします。 -// 内部で MATH_QSort を使用しているので、MATH_QSortStackSize() 関数で取得できる -// サイズの作業バッファを buf に与える必要があります。 -// このサイズは (log2(num)+1) * 8 byte となっています。 -// 作業バッファを渡さない場合には、スタックからこのサイズの作業領域が確保されます。 -// -// info ソートする TitleSortSet 配列の先頭アドレス -// num ソートする配列の要素数 -// buf 作業バッファ -void SortTitle( TitleSortSet *info, u32 num, void *buf ); - -/*===========================================================================*/ - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* TWL_SORT_TITLE_H_ */ - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/main.rsf b/build/tests/TestComponent/ARM9.TWL/main.rsf index 9145d88f..7d39d6cb 100644 --- a/build/tests/TestComponent/ARM9.TWL/main.rsf +++ b/build/tests/TestComponent/ARM9.TWL/main.rsf @@ -223,10 +223,10 @@ RomSpec { Offset 0x00000000 Segment ALL - HostRoot $(TWL_IPL_RED_ROOT)/build/systemMenu_tools/NandInitializerRed/data - Root /data - File cert.sys - HostRoot $(PRIVKEY_PATH) - Root /key - File $(HWINFO_PRIVKEY) $(HWID_PRIVKEY) +# HostRoot $(TWL_IPL_RED_ROOT)/build/systemMenu_tools/NandInitializerRed/data +# Root /data +# File cert.sys +# HostRoot $(PRIVKEY_PATH) +# Root /key +# File $(HWINFO_PRIVKEY) $(HWID_PRIVKEY) } diff --git a/build/tests/TestComponent/ARM9.TWL/src/cursor.c b/build/tests/TestComponent/ARM9.TWL/src/cursor.c deleted file mode 100644 index 1847a62f..00000000 --- a/build/tests/TestComponent/ARM9.TWL/src/cursor.c +++ /dev/null @@ -1,93 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: cursor.c - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include -#include "graphics.h" -#include "cursor.h" - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - 内部変数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - 関数定義 - *---------------------------------------------------------------------------*/ -void SetCursorPos(u16 x, u16 y) -{ - GXOamAttr oam; - -/* [] - G2_SetOBJAttr( - &oam, - x, y, - 0, - GX_OAM_MODE_NORMAL, - FALSE, - GX_OAM_EFFECT_FLIP_H, - GX_OAM_SHAPE_8x8, - GX_OAM_COLORMODE_16, - 0xf6, // charNo - 0, - 0 - ); - - DC_FlushRange( &oam, sizeof(GXOamAttr) ); - GXS_LoadOAM( &oam, 8, sizeof(GXOamAttr) ); - - G2_SetOBJAttr( - &oam, - x+31, y, - 0, - GX_OAM_MODE_NORMAL, - FALSE, - GX_OAM_EFFECT_NONE, - GX_OAM_SHAPE_8x8, - GX_OAM_COLORMODE_16, - 0xf6, // charNo - 0, - 0 - ); - - DC_FlushRange( &oam, sizeof(GXOamAttr) ); - GXS_LoadOAM( &oam, 16, sizeof(GXOamAttr) ); -*/ - - G2_SetOBJAttr( - &oam, - x, y, - 0, - GX_OAM_MODE_NORMAL, - FALSE, - GX_OAM_EFFECT_NONE, - GX_OAM_SHAPE_8x8, - GX_OAM_COLORMODE_16, - 0xff, // charNo - 0, - 0 - ); - DC_FlushRange( &oam, sizeof(GXOamAttr) ); - GXS_LoadOAM( &oam, 24, sizeof(GXOamAttr) ); -} - diff --git a/build/tests/TestComponent/ARM9.TWL/src/kami_write_nandfirm.c b/build/tests/TestComponent/ARM9.TWL/src/kami_write_nandfirm.c deleted file mode 100644 index cac9c5ee..00000000 --- a/build/tests/TestComponent/ARM9.TWL/src/kami_write_nandfirm.c +++ /dev/null @@ -1,332 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: kami_write_nandfirm.c - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include -#include -#include -#include -#include -#include "kami_font.h" -#include "kami_pxi.h" - -#include -#include "kami_write_nandfirm.h" - -/*---------------------------------------------------------------------------* - マクロ定義 - *---------------------------------------------------------------------------*/ - -// NANDファーム書き込みの際にNVRAMの未割り当て領域+予約領域を0クリアする場合は定義します(開発用) -//#define CLEAR_NON_ASIGNED_AREA_AND_RESERVED_AREA_ALL - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -#define NAND_BLOCK_BYTE 0x200 -#define NAND_FIRM_START_OFFSET 0x200 -#define NAND_FIRM_START_OFFSET_IN_FILE 0x200 - -#define NVRAM_PAGE_SIZE 0x100 -#define NVRAM_NORFIRM_RESERVED_ADDRESS 0x200 -#define NVRAM_NORFIRM_NANDBOOT_FLAG_OFFSET 0xff -#define NVRAM_NORFIRM_NANDBOOT_FLAG 0x80 - -#define NVRAM_NON_ASIGNED_AREA_ADDRESS 0x300 - -/*---------------------------------------------------------------------------* - 内部変数定義 - *---------------------------------------------------------------------------*/ - -static u8 sNvramPageSizeBuffer[NVRAM_PAGE_SIZE] ATTRIBUTE_ALIGN(32); // ARM7からアクセスするためスタックでは駄目 -static u32 sReservedAreaEndAddress; - -/*---------------------------------------------------------------------------* - 内部関数定義 - *---------------------------------------------------------------------------*/ - -void kamiEraseNandfirmVersion( u32 nandfirmsize ); - -/*---------------------------------------------------------------------------* - Name: kamiWriteNandfirm - - Description: - - Arguments: no - - Returns: None. - *---------------------------------------------------------------------------*/ -BOOL kamiWriteNandfirm(const char* pFullPath, NAMAlloc allocFunc, NAMFree freeFunc) -{ - FSFile file; - - BOOL open_is_ok; - BOOL read_is_ok; - u8* pTempBuf; - u32 file_size; - u32 nandfirm_size; - u32 alloc_size; - u32 write_block; - BOOL result = TRUE; - u16 crc_w1, crc_w2; - u16 crc_r1, crc_r2; - u16 crc_norfirm_reserved_area_w, crc_norfirm_reserved_area_r; -#ifdef CLEAR_NON_ASIGNED_AREA_AND_RESERVED_AREA_ALL - u32 write_offset; -#endif // CLEAR_NON_ASIGNED_AREA_AND_RESERVED_AREA_ALL - - // .nandファイルオープン - FS_InitFile(&file); - open_is_ok = FS_OpenFile(&file, pFullPath); - if (!open_is_ok) - { - OS_Warning("Failure! FS_OpenFile"); - return FALSE; - } - - // サイズチェック - file_size = FS_GetFileLength(&file) ; - if (file_size > (800*1024)) - { - kamiFontPrintfConsoleEx(1, "too big file size!\n"); - FS_CloseFile(&file); - return FALSE; - } - - nandfirm_size = file_size - NAND_FIRM_START_OFFSET_IN_FILE; - - // バッファ確保 - // 書き込みがブロック単位(512byte)であることを考慮し512アライメントを確保 - alloc_size = MATH_ROUNDUP(file_size, 512); - pTempBuf = allocFunc( alloc_size ); - if (pTempBuf == NULL) - { - kamiFontPrintfConsoleEx(1, "Fail Alloc()!\n"); - FS_CloseFile(&file); - return FALSE; - } - - MI_CpuClear8( pTempBuf, alloc_size ); - - // .nandファイルリード - DC_FlushRange(pTempBuf, alloc_size); - read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size ); - DC_FlushRange(pTempBuf, file_size); - if (!read_is_ok) - { - kamiFontPrintfConsoleEx(1, "Fail FS_ReadFile!\n"); - FS_CloseFile(&file); - freeFunc(pTempBuf); - return FALSE; - } - - // ファイルクローズ - FS_CloseFile(&file); - - // 書き込み前のCRCを計算 - crc_w1 = SVC_GetCRC16( 0xffff, pTempBuf, sizeof(NORHeaderDS) ); - crc_w2 = SVC_GetCRC16( 0xffff, pTempBuf+NAND_FIRM_START_OFFSET_IN_FILE, nandfirm_size ); - - // まずNORHeaderDS領域を書き込む(40byte?) - if (NVRAMi_Write(0, sizeof(NORHeaderDS), (void*)pTempBuf) != NVRAM_RESULT_SUCCESS) - { - kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Write()\n"); - result = FALSE; - } - - // CRCを計算するので念のためにクリアしてからリードする - MI_CpuClear8( pTempBuf, sizeof(NORHeaderDS) ); - DC_FlushRange(pTempBuf, sizeof(NORHeaderDS)); - - // CRCチェックのためNvramからリード - if (NVRAMi_Read(0, sizeof(NORHeaderDS), pTempBuf) != NVRAM_RESULT_SUCCESS) - { - kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Read()!\n"); - } - DC_FlushRange(pTempBuf, sizeof(NORHeaderDS)); - - // 書き込み後のCRCを計算 - crc_r1 = SVC_GetCRC16( 0xffff, pTempBuf, sizeof(NORHeaderDS) ); - - // NVRAM先頭部分のCRC比較 - if ( crc_w1 != crc_r1 ) - { - freeFunc(pTempBuf); - kamiFontPrintfConsoleEx(1, "Fail! CRC check %x!=%x\n", crc_w1, crc_r1); - return FALSE; - } - - // nandfirm 起動フラグを立てる - MI_CpuClear8( sNvramPageSizeBuffer, NVRAM_PAGE_SIZE ); - sNvramPageSizeBuffer[NVRAM_NORFIRM_NANDBOOT_FLAG_OFFSET] = NVRAM_NORFIRM_NANDBOOT_FLAG; - DC_FlushRange( sNvramPageSizeBuffer, NVRAM_PAGE_SIZE); - - // NORファームリザーブ領域の書き込みデータのCRCを計算 - crc_norfirm_reserved_area_w = SVC_GetCRC16( 0xffff, sNvramPageSizeBuffer, NVRAM_PAGE_SIZE ); - - if (NVRAMi_Write(NVRAM_NORFIRM_RESERVED_ADDRESS, NVRAM_PAGE_SIZE, sNvramPageSizeBuffer) != NVRAM_RESULT_SUCCESS) - { - kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Write()\n"); - result = FALSE; - } - - // CRCを計算するので念のためにクリアしてからリードする - MI_CpuClear8( sNvramPageSizeBuffer, NVRAM_PAGE_SIZE ); - - // 読み込みはARM7が直接メモリに書き出すため - DC_FlushRange(sNvramPageSizeBuffer, NVRAM_PAGE_SIZE); - - if (NVRAMi_Read(NVRAM_NORFIRM_RESERVED_ADDRESS, NVRAM_PAGE_SIZE, sNvramPageSizeBuffer) != NVRAM_RESULT_SUCCESS) - { - kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Read()\n"); - result = FALSE; - } - - // 書き込み後のCRCを計算 - DC_FlushRange(sNvramPageSizeBuffer, NVRAM_PAGE_SIZE); - crc_norfirm_reserved_area_r = SVC_GetCRC16( 0xffff, sNvramPageSizeBuffer, NVRAM_PAGE_SIZE ); - - // NORファームリザーブ領域のCRC比較 - if ( crc_norfirm_reserved_area_w != crc_norfirm_reserved_area_r ) - { - kamiFontPrintfConsoleEx(1, "Fail! Norfirm Reserved Area CRC check %x!=%x\n", crc_norfirm_reserved_area_w, crc_norfirm_reserved_area_r); - result = FALSE; - } - -#ifdef CLEAR_NON_ASIGNED_AREA_AND_RESERVED_AREA_ALL - DC_InvalidateRange( sNvramPageSizeBuffer, NVRAM_PAGE_SIZE ); - // 未割り当て領域+予約領域を0クリアします(開発用) - if (NVRAMi_Read(NVRAM_CONFIG_DATA_OFFSET_ADDRESS, NVRAM_PAGE_SIZE, &sNvramPageSizeBuffer) != NVRAM_RESULT_SUCCESS) - { - kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Read()\n"); - result = FALSE; - } - sReservedAreaEndAddress = (u32)(*(u16 *)sNvramPageSizeBuffer << NVRAM_CONFIG_DATA_OFFSET_SHIFT) - 0xA00;// TWL WiFi設定 + NTR WiFi設定 を差し引く - //OS_Printf("end = %x\n", sReservedAreaEndAddress); - - MI_CpuFill8( sNvramPageSizeBuffer, 0x00, NVRAM_PAGE_SIZE ); - DC_FlushRange( sNvramPageSizeBuffer, NVRAM_PAGE_SIZE ); - - for (write_offset=NVRAM_NON_ASIGNED_AREA_ADDRESS; write_offset < sReservedAreaEndAddress; write_offset += NVRAM_PAGE_SIZE) - { - if (NVRAMi_Write(write_offset, NVRAM_PAGE_SIZE, sNvramPageSizeBuffer) != NVRAM_RESULT_SUCCESS) - { - kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Write()\n"); - result = FALSE; - } - } - //OS_Printf("write_offset = %x\n", write_offset); -#else - // 未割り当て領域先頭256byte+予約領域を0クリアします - - MI_CpuFill8( sNvramPageSizeBuffer, 0x00, NVRAM_PAGE_SIZE ); - DC_FlushRange( sNvramPageSizeBuffer, NVRAM_PAGE_SIZE ); - - if (NVRAMi_Write(NVRAM_NON_ASIGNED_AREA_ADDRESS, NVRAM_PAGE_SIZE, sNvramPageSizeBuffer) != NVRAM_RESULT_SUCCESS) - { - kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Write()\n"); - result = FALSE; - } - - DC_InvalidateRange( sNvramPageSizeBuffer, NVRAM_PAGE_SIZE ); - if (NVRAMi_Read(NVRAM_CONFIG_DATA_OFFSET_ADDRESS, NVRAM_PAGE_SIZE, &sNvramPageSizeBuffer) != NVRAM_RESULT_SUCCESS) - { - kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Read()\n"); - result = FALSE; - } - sReservedAreaEndAddress = (u32)(*(u16 *)sNvramPageSizeBuffer << NVRAM_CONFIG_DATA_OFFSET_SHIFT) - 0xA00;// TWL WiFi設定 + NTR WiFi設定 を差し引く - - MI_CpuFill8( sNvramPageSizeBuffer, 0x00, NVRAM_PAGE_SIZE ); - DC_FlushRange( sNvramPageSizeBuffer, NVRAM_PAGE_SIZE ); - - if (NVRAMi_Write(sReservedAreaEndAddress - 0x100, NVRAM_PAGE_SIZE, sNvramPageSizeBuffer) != NVRAM_RESULT_SUCCESS) - { - kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Write()\n"); - result = FALSE; - } -#endif - - // NANDログ情報のクリア - if (kamiClearNandErrorLog() != KAMI_RESULT_SUCCESS) - { - kamiFontPrintfConsoleEx(1, "Fail kamiClearNandErrorLog()\n"); - result = FALSE; - } - - // nandfirmバージョンの消去(デバッグ用) - kamiEraseNandfirmVersion(nandfirm_size); - -// kamiFontPrintfConsoleEx(0, "NAND Firm Import Start!\n"); - - // NAND書き込み - write_block = nandfirm_size/NAND_BLOCK_BYTE + (nandfirm_size % NAND_BLOCK_BYTE != 0); - kamiNandWrite( NAND_FIRM_START_OFFSET/NAND_BLOCK_BYTE, pTempBuf+NAND_FIRM_START_OFFSET, write_block ); // ブロック単位、バイト単位、ブロック単位 - kamiFontLoadScreenData(); - - // CRCを計算するので念のためにクリアしてからリードする - MI_CpuClear8( pTempBuf, nandfirm_size ); - DC_FlushRange(pTempBuf, nandfirm_size); - - // CRCチェックのためNandからリード - if (kamiNandRead(NAND_FIRM_START_OFFSET/NAND_BLOCK_BYTE, pTempBuf, write_block ) == KAMI_RESULT_SEND_ERROR) - { - kamiFontPrintfConsoleEx(1, "kamiNandRead ... %s!\n", "ERROR"); - } - DC_FlushRange(pTempBuf, nandfirm_size); - - // 書き込み後のCRCを計算 - crc_r2 = SVC_GetCRC16( 0xffff, pTempBuf, nandfirm_size ); - - // NAND部分についてのCRCチェック - if (crc_w2 == crc_r2) - { -// kamiFontPrintfConsoleEx(0, "Success! CRC check %x==%x\n", crc_w2, crc_r2); - } - else - { - result = FALSE; - kamiFontPrintfConsoleEx(1, "Fail! CRC check %x!=%x\n", crc_w2, crc_r2); - } - - // メモリ解放 - freeFunc(pTempBuf); - - return result; -} - -/*---------------------------------------------------------------------------* - Name: kamiEraseNandfirmVersion - - Description: nandfirmのバージョン情報を消去します。(デバッグ用) - - Arguments: no - - Returns: None. - *---------------------------------------------------------------------------*/ -void kamiEraseNandfirmVersion( u32 nandfirmsize ) -{ - u8 buffer[NAND_BLOCK_BYTE]; - u32 blockNo; - - if ((nandfirmsize % NAND_BLOCK_BYTE)==0) - { - blockNo = NAND_FIRM_START_OFFSET/NAND_BLOCK_BYTE + nandfirmsize/NAND_BLOCK_BYTE; - MI_CpuClear8( buffer, NAND_BLOCK_BYTE ); - DC_FlushRange(buffer, NAND_BLOCK_BYTE); - kamiNandWrite( blockNo, buffer, 1 ); // ブロック単位、バイト単位、ブロック単位 - } -} diff --git a/build/tests/TestComponent/ARM9.TWL/src/main.c b/build/tests/TestComponent/ARM9.TWL/src/main.c index ac9585b1..64ca2f34 100644 --- a/build/tests/TestComponent/ARM9.TWL/src/main.c +++ b/build/tests/TestComponent/ARM9.TWL/src/main.c @@ -23,18 +23,19 @@ #include #include #include "kami_font.h" -#include "process_format.h" -#include "process_topmenu.h" #include "graphics.h" #include "keypad.h" #include "kami_pxi.h" -#include "process_fade.h" -#include "hwi.h" #define SCRAMBLE_MASK 0x00406000 extern void HWInfoWriterInit( void ); +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ +typedef void* (*Process)(void); + /*---------------------------------------------------------------------------* 内部変数定義 *---------------------------------------------------------------------------*/ @@ -48,6 +49,11 @@ static FSEventHook sSDHook; static void VBlankIntr(void); static void InitAllocation(void); +static void* DummyProcess0(void) +{ + return DummyProcess0; +} + /*---------------------------------------------------------------------------* Name: TwlMain @@ -125,16 +131,9 @@ TwlMain() } // 初期シーケンス設定 - sProcess = TopmenuProcess0; + sProcess = DummyProcess0; - kamiFontPrintfConsole( CONSOLE_ORANGE, "How to \n"); - kamiFontPrintfConsole( CONSOLE_ORANGE, "+---------------------------+\n"); - kamiFontPrintfConsole( CONSOLE_ORANGE, "l A Button : Select Menu l\n"); - kamiFontPrintfConsole( CONSOLE_ORANGE, "l Up/Down Key : Change Menu l\n"); -#ifndef NAND_INITIALIZER_LIMITED_MODE - kamiFontPrintfConsole( CONSOLE_ORANGE, "l L&R Button : Auto Init l\n"); -#endif - kamiFontPrintfConsole( CONSOLE_ORANGE, "+---------------------------+\n"); + kamiFontPrintfConsole( CONSOLE_ORANGE, "This is Test Component\n"); #ifdef TWL_CAPTURE_VERSION // memory-launcher経由で立ち上がるTWLCaptureSystemWriterでは @@ -156,27 +155,6 @@ TwlMain() // NAMライブラリ初期化 NAM_Init( OS_AllocFromMain, OS_FreeToMain); NAMUT_Init( OS_AllocFromMain, OS_FreeToMain); - -#ifdef TWL_CAPTURE_VERSION - kamiFontPrintfConsoleEx(CONSOLE_RED, "[No Signature MODE]\n" ); -#else - // HWInfo関連の前準備 - switch (HWI_Init( OS_AllocFromMain, OS_FreeToMain )) - { - case HWI_INIT_FAILURE: - kamiFontPrintfConsoleEx(CONSOLE_RED, "HWI_INIT() Failure!\n" ); - break; - case HWI_INIT_SUCCESS_PRO_SIGNATURE_MODE: - kamiFontPrintfConsoleEx(CONSOLE_ORANGE, "[PRO Signature MODE]\n" ); - break; - case HWI_INIT_SUCCESS_DEV_SIGNATURE_MODE: - kamiFontPrintfConsoleEx(CONSOLE_ORANGE, "[DEV Signature MODE]\n" ); - break; - case HWI_INIT_SUCCESS_NO_SIGNATRUE_MODE: - kamiFontPrintfConsoleEx(CONSOLE_RED, "[No Signature MODE]\n" ); - break; - } -#endif /* { diff --git a/build/tests/TestComponent/ARM9.TWL/src/process_auto.c b/build/tests/TestComponent/ARM9.TWL/src/process_auto.c deleted file mode 100644 index c9213459..00000000 --- a/build/tests/TestComponent/ARM9.TWL/src/process_auto.c +++ /dev/null @@ -1,288 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_auto.c - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include -#include "kami_font.h" -#include "process_topmenu.h" -#include "process_format.h" -#include "process_hw_info.h" -#include "process_import.h" -#include "process_write_data.h" -#include "process_nandfirm.h" -#include "process_norfirm.h" -#include "process_auto.h" -#include "process_fade.h" -#include "process_mcu.h" -#include "cursor.h" -#include "keypad.h" - -#ifdef TWL_CAPTURE_VERSION -// TWLCAPTURE生産工程書き込み用 -#include "process_nandfirm_twlc.h" -#include "process_import_twlc.h" -#endif - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - グローバル変数定義 - *---------------------------------------------------------------------------*/ - -BOOL gAutoFlag = FALSE; -AutoProcessResult gAutoProcessResult[AUTO_PROCESS_MENU_NUM]; - -/*---------------------------------------------------------------------------* - 内部変数定義 - *---------------------------------------------------------------------------*/ - -static s8 sMenuSelectNo; - -/*---------------------------------------------------------------------------* - 内部関数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - プロセス関数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Name: Top Menu プロセス0 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* AutoProcess0(void) -{ - s32 i; - - // オートフラグセット - gAutoFlag = TRUE; - - // 処理結果初期化 - for (i=0;i -#include -#include -#include -#include "kami_font.h" -#include "kami_pxi.h" -#include "process_topmenu.h" -#include "process_eticket.h" -#include "process_auto.h" -#include "process_fade.h" -#include "cursor.h" -#include "keypad.h" - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -#define NUM_OF_MENU_SELECT 2 -#define DOT_OF_MENU_SPACE 16 -#define CURSOR_ORIGIN_X 32 -#define CURSOR_ORIGIN_Y 56 - -#define ROUND_UP(value, alignment) \ - (((u32)(value) + (alignment-1)) & ~(alignment-1)) - -/*---------------------------------------------------------------------------* - 内部変数定義 - *---------------------------------------------------------------------------*/ - -static s8 sMenuSelectNo; - -/*---------------------------------------------------------------------------* - 内部関数宣言 - *---------------------------------------------------------------------------*/ - -static BOOL MakeETicketFile(void); - -/*---------------------------------------------------------------------------* - プロセス関数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Name: eTicket プロセス0 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* eTicketProcess0(void) -{ - int i; - - // 文字列全クリア - kamiFontClear(); - - // バージョン表示 - kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Write eTicket Sign"); - kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); - - // メニュー一覧 - kamiFontPrintf(3, 6, FONT_COLOR_BLACK, "+-------------------+-----+"); - kamiFontPrintf(3, 7, FONT_COLOR_BLACK, "l WRITE E-TICKET l l"); - kamiFontPrintf(3, 8, FONT_COLOR_BLACK, "+-------------------+-----+"); - kamiFontPrintf(3, 9, FONT_COLOR_BLACK, "l RETURN l l"); - kamiFontPrintf(3, 10, FONT_COLOR_BLACK, "+-------------------+-----+"); - - // 背景全クリア - for (i=0;i<24;i++) - { - kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); - } - - // 背景上部 - kamiFontFillChar( 0, BG_COLOR_GRAY, BG_COLOR_GRAY ); - kamiFontFillChar( 1, BG_COLOR_GRAY, BG_COLOR_GRAY ); - kamiFontFillChar( 2, BG_COLOR_GRAY, BG_COLOR_TRANS ); - - // カーソル消去 - SetCursorPos((u16)200, (u16)200); - - FADE_IN_RETURN( eTicketProcess1 ); -} - -/*---------------------------------------------------------------------------* - Name: eTicket プロセス1 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* eTicketProcess1(void) -{ - // オート実行用 - if (gAutoFlag) - { - sMenuSelectNo = 0; - return eTicketProcess2; - } - - // 選択メニューの変更 - if ( kamiPadIsRepeatTrigger(PAD_KEY_UP) ) - { - if (--sMenuSelectNo < 0) sMenuSelectNo = NUM_OF_MENU_SELECT -1; - } - else if ( kamiPadIsRepeatTrigger(PAD_KEY_DOWN) ) - { - if (++sMenuSelectNo >= NUM_OF_MENU_SELECT) sMenuSelectNo = 0; - } - - // カーソル配置 - SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); - - // 決定 - if (kamiPadIsTrigger(PAD_BUTTON_A)) - { - return eTicketProcess2; - } - // トップメニューへ戻る - else if (kamiPadIsTrigger(PAD_BUTTON_B)) - { - FADE_OUT_RETURN( TopmenuProcess0 ); - } - - return eTicketProcess1; -} - -/*---------------------------------------------------------------------------* - Name: eTicket プロセス2 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* eTicketProcess2(void) -{ - BOOL result; - - switch( sMenuSelectNo ) - { - case 0: - result = MakeETicketFile(); - if (result) - { - kamiFontPrintf(25, 7, FONT_COLOR_GREEN, "OK"); - } - else - { - kamiFontPrintf(25, 7, FONT_COLOR_RED, "NG"); - } - break; - case 1: - FADE_OUT_RETURN( TopmenuProcess0 ); - } - - // Auto用 - if (gAutoFlag) - { - if (result) { FADE_OUT_RETURN( AutoProcess1 ); } - else { FADE_OUT_RETURN( AutoProcess2); } - } - - return eTicketProcess1; -} - -/*---------------------------------------------------------------------------* - 処理関数定義 - *---------------------------------------------------------------------------*/ - -static BOOL MakeETicketFile(void) -{ - FSFile file; - FATFSFileHandle fat_handle; - - BOOL open_is_ok; - BOOL read_is_ok; - void* pTempBuf; - u32 file_size; - u32 alloc_size; - BOOL result = TRUE; - - // F:sys/cert.sysが既に存在するなら何もしない - fat_handle = FATFS_OpenFile(E_TICKET_FILE_PATH_IN_NAND, "r"); - if (fat_handle) - { - kamiFontPrintfConsoleEx(CONSOLE_RED, "%s already exist\n", E_TICKET_FILE_PATH_IN_NAND); - kamiFontPrintf(2, 20, FONT_COLOR_RED, "%s already exist", E_TICKET_FILE_PATH_IN_NAND); - FATFS_CloseFile(fat_handle); - return FALSE; - } - - // ROMファイルオープン - FS_InitFile(&file); - open_is_ok = FS_OpenFile(&file, E_TICKET_FILE_PATH_IN_ROM); - if (!open_is_ok) - { - OS_Printf("FS_OpenFile(\"%s\") ... ERROR!\n", E_TICKET_FILE_PATH_IN_ROM); - return FALSE; - } - - // ROMファイルリード - file_size = FS_GetFileLength(&file) ; - alloc_size = ROUND_UP(file_size, 32) ; - pTempBuf = OS_Alloc( alloc_size ); - SDK_NULL_ASSERT(pTempBuf); - DC_InvalidateRange(pTempBuf, alloc_size); - read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size ); - if (!read_is_ok) - { - kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_ReadFile(\"%s\") ... ERROR!\n", E_TICKET_FILE_PATH_IN_ROM); - FS_CloseFile(&file); - OS_Free(pTempBuf); - return FALSE; - } - - // ROMファイルクローズ - FS_CloseFile(&file); - - // F:sys/cert.sys作成 - if (!FATFS_CreateFile(E_TICKET_FILE_PATH_IN_NAND, TRUE, "rwxrwxrwx")) - { - kamiFontPrintfConsoleEx(CONSOLE_RED, "FATFS_CreateFile(%s) failed.\n", E_TICKET_FILE_PATH_IN_NAND); - result = FALSE; - } - else - { - // F:sys/cert.sysオープン - fat_handle = FATFS_OpenFile(E_TICKET_FILE_PATH_IN_NAND, "w"); - if (!fat_handle) - { - kamiFontPrintfConsoleEx(CONSOLE_RED, "FATFS_OpenFile(%s) failed.\n", E_TICKET_FILE_PATH_IN_NAND); - result = FALSE; - } - // F:sys/cert.sys書き込み - else if (FATFS_WriteFile(fat_handle, pTempBuf, (s32)file_size) == -1) - { - kamiFontPrintfConsoleEx(CONSOLE_RED, "FATFS_WritFile() failed.\n"); - result = FALSE; - } - (void)FATFS_CloseFile(fat_handle); - } - - OS_Free(pTempBuf); - - return result; -} - diff --git a/build/tests/TestComponent/ARM9.TWL/src/process_fade.c b/build/tests/TestComponent/ARM9.TWL/src/process_fade.c deleted file mode 100644 index 29681ec4..00000000 --- a/build/tests/TestComponent/ARM9.TWL/src/process_fade.c +++ /dev/null @@ -1,109 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_fade.c - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include -#include "process_fade.h" - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - 内部変数定義 - *---------------------------------------------------------------------------*/ - -static Process sNextProcess; -static int brightness = 16; - -/*---------------------------------------------------------------------------* - 内部関数宣言 - *---------------------------------------------------------------------------*/ - -static BOOL MakeETicketFile(void); - -/*---------------------------------------------------------------------------* - プロセス関数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Name: fadeInProcess プロセス - - Description: フェードインを行い完了後にsNextProcessに遷移します - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ -void* fadeInProcess(void) -{ - if (--brightness < 0) - { - brightness = 0; - return sNextProcess; - } - else - { - GXS_SetMasterBrightness(brightness); - return fadeInProcess; - } -} - -/*---------------------------------------------------------------------------* - Name: fadeOutProcess プロセス - - Description: フェードアウトを行い完了後にsNextProcessに遷移します - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ -void* fadeOutProcess(void) -{ - if (++brightness > 16) - { - brightness = 16; - return sNextProcess; - } - else - { - GXS_SetMasterBrightness(brightness); - return fadeOutProcess; - } -} - -/*---------------------------------------------------------------------------* - その他関数定義 - *---------------------------------------------------------------------------*/ -/*---------------------------------------------------------------------------* - Name: SetNextProcess - - Description: プロセスの遷移時にフェードを使いたい場合に使用します - - Arguments: processフェード完了後のプロセス - - Returns: None. - *---------------------------------------------------------------------------*/ - -void SetNextProcess(Process process) -{ - sNextProcess = process; -} - diff --git a/build/tests/TestComponent/ARM9.TWL/src/process_format.c b/build/tests/TestComponent/ARM9.TWL/src/process_format.c deleted file mode 100644 index 92cfa168..00000000 --- a/build/tests/TestComponent/ARM9.TWL/src/process_format.c +++ /dev/null @@ -1,442 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_format.c - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include -#include -#include -#include -#include -#include -#include "kami_font.h" -#include "kami_pxi.h" -#include "process_topmenu.h" -#include "process_format.h" -#include "process_hw_info.h" -#include "process_auto.h" -#include "process_fade.h" -#include "cursor.h" -#include "keypad.h" -#include "debugger_hw_reset_control.h" - -#include - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -enum { - MENU_CLEAN_UP=0, - MENU_CHECK_DISK, -#ifndef NAND_INITIALIZER_LIMITED_MODE - MENU_NORMAL_FORMAT, - MENU_FILL_FORMAT, -#endif - MENU_RETURN, - NUM_OF_MENU_SELECT -}; - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -// NANDの簡易フォーマットを実行する際にツリー情報を出力する場合は定義します。 -// -//#define DUMP_NAND_TREE - -#define DOT_OF_MENU_SPACE 16 -#define CURSOR_ORIGIN_X 32 -#define CURSOR_ORIGIN_Y 56 -#define CHAR_OF_MENU_SPACE 2 - -/*---------------------------------------------------------------------------* - 内部変数定義 - *---------------------------------------------------------------------------*/ - -static s8 sMenuSelectNo; -static u8 sLock; -static u8 sFormatResult; - -#ifndef NAND_INITIALIZER_LIMITED_MODE -static u8 sAutoModeSequence; -#endif // NAND_INITIALIZER_LIMITED_MODE - -/*---------------------------------------------------------------------------* - 内部関数宣言 - *---------------------------------------------------------------------------*/ - -static void FormatCallback(KAMIResult result, void* arg); -void* ForeverLoopProcess(void); - -/*---------------------------------------------------------------------------* - プロセス関数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Name: Format プロセス0 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* FormatProcess0(void) -{ - int i; - - // 文字列全クリア - kamiFontClear(); - - // バージョン表示 - kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Format Nand Flash"); - kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); - - // メニュー一覧 - kamiFontPrintf(3, 6, FONT_COLOR_BLACK, "+-------------------+-----+"); - kamiFontPrintf(3, 7, FONT_COLOR_BLACK, "l NAND Clean Up l l"); - kamiFontPrintf(3, 8, FONT_COLOR_BLACK, "+-------------------+-----+"); - kamiFontPrintf(3, 9, FONT_COLOR_BLACK, "l CHECK DISK l l"); - kamiFontPrintf(3, 10, FONT_COLOR_BLACK, "+-------------------+-----+"); -#ifndef NAND_INITIALIZER_LIMITED_MODE - kamiFontPrintf(3, 11, FONT_COLOR_BLACK, "l FORMAT l l"); - kamiFontPrintf(3, 12, FONT_COLOR_BLACK, "+-------------------+-----+"); - kamiFontPrintf(3, 13, FONT_COLOR_BLACK, "l FORMAT l l"); - kamiFontPrintf(3, 14, FONT_COLOR_BLACK, "+-------------------+-----+"); - kamiFontPrintf(3, 15, FONT_COLOR_BLACK, "l RETURN l l"); - kamiFontPrintf(3, 16, FONT_COLOR_BLACK, "+-------------------+-----+"); -#else - kamiFontPrintf(3, 11, FONT_COLOR_BLACK, "l RETURN l l"); - kamiFontPrintf(3, 12, FONT_COLOR_BLACK, "+-------------------+-----+"); -#endif - - // 背景全クリア - for (i=0;i<24;i++) - { - kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); - } - - // 背景上部 - kamiFontFillChar( 0, BG_COLOR_BLUE, BG_COLOR_BLUE ); - kamiFontFillChar( 1, BG_COLOR_BLUE, BG_COLOR_BLUE ); - kamiFontFillChar( 2, BG_COLOR_BLUE, BG_COLOR_TRANS ); - - // カーソル除外 - SetCursorPos((u16)200, (u16)200); - - FADE_IN_RETURN( FormatProcess1 ); -} - -/*---------------------------------------------------------------------------* - Name: Format プロセス1 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* FormatProcess1(void) -{ -#ifndef NAND_INITIALIZER_LIMITED_MODE - // オート実行用 - if (gAutoFlag) - { - if (sAutoModeSequence == 0) - { - sMenuSelectNo = MENU_NORMAL_FORMAT; - } - else - { - sMenuSelectNo = MENU_CLEAN_UP; - } - return FormatProcess2; - } -#endif - -#ifdef USE_FOR_NIGHTLY_AUTO_TEST - sMenuSelectNo = MENU_CLEAN_UP; - return FormatProcess2; -#endif //USE_FOR_NIGHTLY_AUTO_TEST - - // 選択メニューの変更 - if ( kamiPadIsRepeatTrigger(PAD_KEY_UP) ) - { - if (--sMenuSelectNo < 0) sMenuSelectNo = NUM_OF_MENU_SELECT -1; - } - else if ( kamiPadIsRepeatTrigger(PAD_KEY_DOWN) ) - { - if (++sMenuSelectNo >= NUM_OF_MENU_SELECT) sMenuSelectNo = 0; - } - - // カーソル配置 - SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); - - // 決定 - if (kamiPadIsTrigger(PAD_BUTTON_A)) - { - return FormatProcess2; - } - // トップメニューへ戻る - else if (kamiPadIsTrigger(PAD_BUTTON_B)) - { - FADE_OUT_RETURN( TopmenuProcess0 ); - } - - return FormatProcess1; -} - -/*---------------------------------------------------------------------------* - Name: Format プロセス2 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* FormatProcess2(void) -{ - if (sLock == FALSE) - { - s16 y_pos = (s16)(7 + sMenuSelectNo * CHAR_OF_MENU_SPACE); - - switch( sMenuSelectNo ) - { - case MENU_CLEAN_UP: // 簡易フォーマット - { - BOOL result = TRUE; -#ifdef DUMP_NAND_TREE - OS_Printf("---------------------------------------\n"); - OS_Printf(" Before \n"); - OS_Printf("---------------------------------------\n"); - NAMUT_DrawNandTree(); -#endif - kamiFontPrintf(24, y_pos, FONT_COLOR_BLACK, " WAIT"); - kamiFontLoadScreenData(); - - // ISデバッガのハードウェアリセットを禁止する - DEBUGGER_HwResetDisable(); - - result &= NAMUT_Format(); - - // ISデバッガのハードウェアリセットを許可する - DEBUGGER_HwResetEnable(); - - if (result) - { - kamiFontPrintf(24, y_pos, FONT_COLOR_GREEN, " OK "); - } - else - { - kamiFontPrintf(24, y_pos, FONT_COLOR_RED, " NG "); - } - -#ifdef DUMP_NAND_TREE - OS_Printf("\n"); - OS_Printf("---------------------------------------\n"); - OS_Printf(" After \n"); - OS_Printf("---------------------------------------\n"); - NAMUT_DrawNandTree(); -#endif - -#ifdef USE_FOR_NIGHTLY_AUTO_TEST - if (result) - { - OS_Printf("NAND_CLEANUP_SUCCESS\n"); - } - return ForeverLoopProcess; -#endif //USE_FOR_NIGHTLY_AUTO_TEST - -#ifndef NAND_INITIALIZER_LIMITED_MODE -#ifdef MARIOCLUB_VERSION - - // Auto用 - if (gAutoFlag) - { - sAutoModeSequence = 0; - - if (result) - { - gAutoProcessResult[AUTO_PROCESS_MENU_MACHINE_INITIALIZE] = AUTO_PROCESS_RESULT_SUCCESS; - FADE_OUT_RETURN( AutoProcess1 ); - } - else - { - gAutoProcessResult[AUTO_PROCESS_MENU_MACHINE_INITIALIZE] = AUTO_PROCESS_RESULT_FAILURE; - FADE_OUT_RETURN( AutoProcess2 ); - } - } -#endif // MARIOCLUB_VERSION -#endif - - return FormatProcess1; - } - case MENU_CHECK_DISK: // チェックディスク - { - FATFSDiskInfo info; - BOOL result = FALSE; - - kamiFontPrintf(24, y_pos, FONT_COLOR_BLACK, " WAIT"); - kamiFontLoadScreenData(); - - // ISデバッガのハードウェアリセットを禁止する - DEBUGGER_HwResetDisable(); - - // チェックディスク実行 - if (FATFS_CheckDisk("nand:", &info, TRUE, TRUE, TRUE)) - { - // チェックディスク実行 - if (FATFS_CheckDisk("nand2:", &info, TRUE, TRUE, TRUE)) - { - result = TRUE; - } - } - - // ISデバッガのハードウェアリセットを許可する - DEBUGGER_HwResetEnable(); - - if (result == TRUE) { kamiFontPrintf(24, y_pos, FONT_COLOR_GREEN, " OK "); } - else { kamiFontPrintf(24, y_pos, FONT_COLOR_RED, " NG "); } - - return FormatProcess1; - } -#ifndef NAND_INITIALIZER_LIMITED_MODE - case MENU_NORMAL_FORMAT: // ノーマルフォーマット - sLock = TRUE; - ExeFormatAsync(FORMAT_MODE_QUICK, FormatCallback); - kamiFontPrintf(24, y_pos, FONT_COLOR_BLACK, " "); - return FormatProcess3; - case MENU_FILL_FORMAT: // フルフォーマット - sLock = TRUE; - ExeFormatAsync(FORMAT_MODE_FULL, FormatCallback); - kamiFontPrintf(24, y_pos, FONT_COLOR_BLACK, " "); - return FormatProcess3; -#endif - case MENU_RETURN: - FADE_OUT_RETURN( TopmenuProcess0 ); - } - } - - return FormatProcess1; -} - -// 割り込み内につき負荷は軽く -static void FormatCallback(KAMIResult result, void* /*arg*/) -{ - s16 y_pos = (s16)(7 + sMenuSelectNo * CHAR_OF_MENU_SPACE); - - if ( result == KAMI_RESULT_SUCCESS_TRUE ) - { - sFormatResult = TRUE; - } - else - { - sFormatResult = FALSE; - } - - // ロック解除 - sLock = FALSE; -} - -/*---------------------------------------------------------------------------* - Name: Format プロセス3 - - Description: フォーマット完了待ちプロセス - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* FormatProcess3(void) -{ - static s32 progress; - s16 y_pos = (s16)(7 + sMenuSelectNo * CHAR_OF_MENU_SPACE); - - // 処理終了判定 - if (sLock == FALSE) - { - progress = 0; - - if ( sFormatResult ) - { - kamiFontPrintf(24, y_pos, FONT_COLOR_GREEN, " OK "); - - // フォーマット後はESに必要なファイルがなくなっているため - // ES_InitLibを呼び出すことで作成しておく - NAM_End(NULL, NULL); - NAM_Init( OS_AllocFromMain, OS_FreeToMain); - } - else - { - kamiFontPrintf(24, y_pos, FONT_COLOR_RED, " NG "); - } - - -#ifndef NAND_INITIALIZER_LIMITED_MODE - // Auto用 - if (gAutoFlag) - { -#ifdef MARIOCLUB_VERSION - sAutoModeSequence = 1; -#endif // MARIOCLUB_VERSION - - if (sFormatResult) - { - gAutoProcessResult[AUTO_PROCESS_MENU_FORMAT] = AUTO_PROCESS_RESULT_SUCCESS; - FADE_OUT_RETURN( AutoProcess1 ); - } - else - { - gAutoProcessResult[AUTO_PROCESS_MENU_FORMAT] = AUTO_PROCESS_RESULT_FAILURE; - FADE_OUT_RETURN( AutoProcess2 ); - } - } -#endif - - return FormatProcess1; - } - - // 進捗表示更新 - if ( ++progress >= 30*5 ) - { - progress = 0; - kamiFontPrintf(24, y_pos, FONT_COLOR_BLACK, " "); - } - - kamiFontPrintf((s16)(24 + (progress / 30)), y_pos, FONT_COLOR_BLACK, "*"); - - return FormatProcess3; -} - -/*---------------------------------------------------------------------------* - Name: Format プロセス4 - - Description: 無限ループプロセス - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* ForeverLoopProcess(void) -{ - return ForeverLoopProcess; -} \ No newline at end of file diff --git a/build/tests/TestComponent/ARM9.TWL/src/process_hw_info.c b/build/tests/TestComponent/ARM9.TWL/src/process_hw_info.c deleted file mode 100644 index 75c16063..00000000 --- a/build/tests/TestComponent/ARM9.TWL/src/process_hw_info.c +++ /dev/null @@ -1,478 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_hw_info.c - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include -#include -#include -#include -#include -#include -#include "kami_font.h" -#include "kami_pxi.h" -#include "process_topmenu.h" -#include "process_hw_info.h" -#include "process_auto.h" -#include "process_fade.h" -#include "cursor.h" -#include "keypad.h" -#include "hwi.h" - -// -#include "TWLHWInfo_api.h" -#include "TWLSettings_api.h" -// -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -enum { - MENU_REGION_JAPAN = 0, - MENU_REGION_AMERICA, - MENU_REGION_EUROPE, - MENU_REGION_AUSTRALIA, - MENU_REGION_CHINA, - MENU_REGION_KOREA, - MENU_RETURN, - NUM_OF_MENU_SELECT -}; - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -#define DOT_OF_MENU_SPACE 16 -#define CHAR_OF_MENU_SPACE 2 -#define MENU_TOP_LINE 5 -#define CURSOR_ORIGIN_X 32 -#define CURSOR_ORIGIN_Y 40 - -#define NANDINITIALIZER_SETTING_FILE_PATH_IN_SD "sdmc:/nandinitializer.ini" - -#define ROUND_UP(value, alignment) \ - (((u32)(value) + (alignment-1)) & ~(alignment-1)) - -/*---------------------------------------------------------------------------* - 内部変数定義 - *---------------------------------------------------------------------------*/ - -static s8 sMenuSelectNo; -static BOOL sWirelessForceOff; - -/*---------------------------------------------------------------------------* - 内部関数宣言 - *---------------------------------------------------------------------------*/ - -static BOOL WriteHWNormalInfoFile( void ); -static BOOL WriteHWSecureInfoFile( u8 region ); -//static BOOL DeleteHWInfoFile( void ); -static BOOL GetNandInitializerSetting(u8* region, u8* wireless); - -/*---------------------------------------------------------------------------* - プロセス関数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Name: HWInfo プロセス0 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* HWInfoProcess0(void) -{ - int i; - - // 文字列全クリア - kamiFontClear(); - - // バージョン表示 - kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Write Hardware Information "); - kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); - - // メニュー一覧 - kamiFontPrintf(3, 4, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf(3, 5, FONT_COLOR_BLACK, "l REGION JAPAN l l"); - kamiFontPrintf(3, 6, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf(3, 7, FONT_COLOR_BLACK, "l REGION AMERICA l l"); - kamiFontPrintf(3, 8, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf(3, 9, FONT_COLOR_BLACK, "l REGION EUROPE l l"); - kamiFontPrintf(3, 10, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf(3, 11, FONT_COLOR_BLACK, "l REGION AUSTRALIA l l"); - kamiFontPrintf(3, 12, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf(3, 13, FONT_COLOR_BLACK, "l REGION CHINA l l"); - kamiFontPrintf(3, 14, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf(3, 15, FONT_COLOR_BLACK, "l REGION KOREA l l"); - kamiFontPrintf(3, 16, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf(3, 17, FONT_COLOR_BLACK, "l RETURN l l"); - kamiFontPrintf(3, 18, FONT_COLOR_BLACK, "+--------------------+----+"); - - // 現在のリージョンに"now"と表示 - kamiFontPrintf(26, (s16)(MENU_TOP_LINE+OS_GetRegion()*CHAR_OF_MENU_SPACE), FONT_COLOR_BLACK, "now"); - - // 背景全クリア - for (i=0;i<24;i++) - { - kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); - } - - // 背景上部 - kamiFontFillChar( 0, BG_COLOR_PURPLE, BG_COLOR_PURPLE ); - kamiFontFillChar( 1, BG_COLOR_PURPLE, BG_COLOR_PURPLE ); - kamiFontFillChar( 2, BG_COLOR_PURPLE, BG_COLOR_TRANS ); - - // カーソル除外 - SetCursorPos((u16)200, (u16)200); - - FADE_IN_RETURN( HWInfoProcess1 ); -} - -/*---------------------------------------------------------------------------* - Name: HWInfo プロセス1 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* HWInfoProcess1(void) -{ -#ifndef NAND_INITIALIZER_LIMITED_MODE - // オート実行用 - if (gAutoFlag) - { - return HWInfoProcess2; - } -#endif - - // 選択メニューの変更 - if ( kamiPadIsRepeatTrigger(PAD_KEY_UP) ) - { - if (--sMenuSelectNo < 0) sMenuSelectNo = NUM_OF_MENU_SELECT -1; - } - else if ( kamiPadIsRepeatTrigger(PAD_KEY_DOWN) ) - { - if (++sMenuSelectNo >= NUM_OF_MENU_SELECT) sMenuSelectNo = 0; - } - - // カーソル配置 - SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); - - // 決定 - if (kamiPadIsTrigger(PAD_BUTTON_A)) - { - return HWInfoProcess2; - } - // トップメニューへ戻る - else if (kamiPadIsTrigger(PAD_BUTTON_B)) - { - FADE_OUT_RETURN( TopmenuProcess0 ); - } - - return HWInfoProcess1; -} - -/*---------------------------------------------------------------------------* - Name: HWInfo プロセス2 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* HWInfoProcess2(void) -{ - int i; - BOOL result; - -#ifndef NAND_INITIALIZER_LIMITED_MODE - // オート実行用 - if (gAutoFlag) - { - // SDカードのnandinitializer.iniより設定を取得 - if (!GetNandInitializerSetting((u8 *)&sMenuSelectNo, (u8 *)&sWirelessForceOff)) - { - // 設定の取得に失敗した場合はデフォルト設定(REGION_JAPAN/WIRELESS_ENABLE) - sMenuSelectNo = 0; - sWirelessForceOff = FALSE; - } - } - else -#endif - { - sWirelessForceOff = LCFG_THW_IsForceDisableWireless(); - } - - switch( sMenuSelectNo ) - { - case MENU_REGION_JAPAN: - case MENU_REGION_AMERICA: - case MENU_REGION_EUROPE: - case MENU_REGION_AUSTRALIA: - case MENU_REGION_CHINA: - case MENU_REGION_KOREA: - - result = WriteHWInfoFile( (u8)sMenuSelectNo, sWirelessForceOff ); - - // 全リージョンの結果をクリア - for (i=0;i -#include -#include -#include -#include -#include -#include -#include "kami_font.h" -#include "kami_pxi.h" -#include "process_topmenu.h" -#include "process_import.h" -#include "process_hw_info.h" -#include "process_eticket.h" -#include "process_auto.h" -#include "process_fade.h" -#include "cursor.h" -#include "keypad.h" -#include "common_utility.h" -#include "TWLHWInfo_api.h" - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -typedef enum { - TAD_WRITE_OPTION_OVERWRITE, // 強制上書き - TAD_WRITE_OPTION_NONEXISTENT, // NANDに同プログラムが存在しない場合に限り書き込み - TAD_WRITE_OPTION_USER // ユーザーに選択させる -} TadWriteOption; - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -#define NUM_OF_MENU_SELECT 4 -#define NUM_OF_MENU_SELECT_INDIVIDUALLY 17 - -#define DOT_OF_MENU_SPACE 16 -#define DOT_OF_MENU_SPACE_INDIVIDUALLY 8 - -#define CHAR_OF_MENU_SPACE 2 -#define CHAR_OF_MENU_SPACE_INDIVIDUALLY 1 - -#define CURSOR_ORIGIN_X 32 -#define CURSOR_ORIGIN_Y 40 - - -// 表示&インポートできる.TADファイルは最大16個まで -// しかもSDカードのルートに存在するファイルのみというお手軽実装 -#define FILE_NUM_MAX 256 -#define QSORT_BUF_SIZE ((8+1) * 8) // サイズは(Log2(FILE_NUM_MAX)+1) * 8 bytes 必要 動的確保できるならそっちの方が楽 - -#define VIEW_LINES_MAX 16 - -/*---------------------------------------------------------------------------* - 内部変数定義 - *---------------------------------------------------------------------------*/ - -static s32 sMenuSelectNo; -static s32 sMenuSelectNoIndividually; - -static LCFGReadResult (*s_pReadSecureInfoFunc)( void ); - -static char sFilePath[FILE_NUM_MAX][FS_ENTRY_LONGNAME_MAX]; -static TitleSortSet sTitleSortSet[FILE_NUM_MAX]; - -static u8 sFileNum; - -static void* spStack; - -static u32 sCurrentProgress; - -static vu8 sNowImport = FALSE; - -static s32 sTadListViewOffset; - -static s32 sLines; - -/*---------------------------------------------------------------------------* - 内部関数宣言 - *---------------------------------------------------------------------------*/ - -static BOOL ImportTad(char* file_name, TadWriteOption option); -static void ProgressThread(void* arg); -static void Destructor(void* arg); -static void ShowTadList(void); -static void DumpTadInfo(void); -static void ShowTitleinfoDifference( NAMTitleInfo* titleInfoNand, NAMTitleInfo* titleInfoSd); -void ProgessInit(void); -void ProgressDraw(f32 ratio); -static void* ImportProcessReturn1(void); - -static void* ImportIndividuallyProcess0(void); -static void* ImportIndividuallyProcess1(void); -static void* ImportIndividuallyProcess2(void); -static void* ImportIndividuallyProcess3(void); - -static void* ImportAllOverwriteProcess0(void); -static void* ImportAllOverwriteProcess1(void); -static void* ImportAllOverwriteProcess2(void); -static void* ImportAllOverwriteProcess3(void); - -static void* ImportAllNonexistentProcess0(void); -static void* ImportAllNonexistentProcess1(void); -static void* ImportAllNonexistentProcess2(void); -static void* ImportAllNonexistentProcess3(void); - -/*---------------------------------------------------------------------------* - プロセス関数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Name: Import プロセス0 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* ImportProcess0(void) -{ - FSFile dir; - int i; - - // 文字列全クリア - kamiFontClear(); - - // バージョン表示 - kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Import TAD from SD"); - kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); - - // メニュー一覧 - kamiFontPrintf(3, 4, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf(3, 5, FONT_COLOR_BLACK, "l OVERWRITE ALL l l"); - kamiFontPrintf(3, 6, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf(3, 7, FONT_COLOR_BLACK, "l WRITE NONEXISTENT l l"); - kamiFontPrintf(3, 8, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf(3, 9, FONT_COLOR_BLACK, "l SELECT FILE >> l l"); - kamiFontPrintf(3, 10, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf(3, 11, FONT_COLOR_BLACK, "l RETURN l l"); - kamiFontPrintf(3, 12, FONT_COLOR_BLACK, "+--------------------+----+"); - - // 配列クリア - MI_CpuClear8( sFilePath, sizeof(sFilePath) ); - MI_CpuClear8( sTitleSortSet, sizeof(sTitleSortSet) ); - - // ファイル数初期化 - sFileNum = 0; - - // 表示オフセット初期化 - sTadListViewOffset = 0; - - // 背景全クリア - for (i=0;i<24;i++) - { - kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); - } - - // 背景上部 - kamiFontFillChar( 0, BG_COLOR_PINK, BG_COLOR_PINK ); - kamiFontFillChar( 1, BG_COLOR_PINK, BG_COLOR_PINK ); - kamiFontFillChar( 2, BG_COLOR_PINK, BG_COLOR_TRANS ); - - FS_InitFile(&dir); - - // SDカードのルートディレクトリを検索 - if ( !FS_OpenDirectory(&dir, "sdmc:/", FS_FILEMODE_R | FS_FILEMODE_W) ) - { - kamiFontPrintfConsole(CONSOLE_RED, "Error FS_OpenDirectory(sdmc:/)\n"); - } - else - { - int l; - char qsortBuf[QSORT_BUF_SIZE]; - FSDirectoryEntryInfo info[1]; - OS_Printf("[%s]:\n", "sdmc:/"); - - kamiFontPrintfConsole(CONSOLE_ORANGE, "------ tad file List -----\n"); - - // .dat .nand .nor を探してファイル名を保存しておく - while (FS_ReadDirectory(&dir, info)) - { - OS_Printf(" %s", info->longname); - if ((info->attributes & (FS_ATTRIBUTE_DOS_DIRECTORY | FS_ATTRIBUTE_IS_DIRECTORY)) != 0) - { - OS_Printf("/\n"); - } - else - { - char* pExtension; - OS_Printf(" (%d BYTEs)\n", info->filesize); - - // 拡張子のチェック - pExtension = STD_SearchCharReverse( info->longname, '.'); - if (pExtension) - { - if (!STD_CompareString( pExtension, ".tad") || !STD_CompareString( pExtension, ".TAD") ) - { - NAMTadInfo tadInfo; - char full_path[FS_ENTRY_LONGNAME_MAX+6]; - - // フルパスを作成 - MakeFullPathForSD(info->longname, full_path); - - STD_CopyString( sFilePath[sFileNum], info->longname ); - // kamiFontPrintfConsole(CONSOLE_ORANGE, "%d:%s\n", sFileNum, info->longname); - - // tadファイルの情報取得 - if (NAM_ReadTadInfo(&tadInfo, full_path) != NAM_OK) - { - // 失敗したらエラーを表示して現在のファイルを飛ばして先へ進む - kamiFontPrintfConsole(CONSOLE_RED, "Error NAM_ReadTadInfo()\n"); - continue; - } - sTitleSortSet[sFileNum].titleID = tadInfo.titleInfo.titleId; - sTitleSortSet[sFileNum].path = sFilePath[sFileNum]; - - if (++sFileNum >= FILE_NUM_MAX) - { - break; - } - } - } - } - } - (void)FS_CloseDirectory(&dir); - - // ファイルパスをTitleID_lo順にソートする - SortTitle( sTitleSortSet, sFileNum, qsortBuf ); - - for( l=0; l= NUM_OF_MENU_SELECT) sMenuSelectNo = 0; - } - - // カーソル配置 - SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); - - // 決定 - if (kamiPadIsTrigger(PAD_BUTTON_A)) - { - return ImportProcess2; - } - // トップメニューへ戻る - else if (kamiPadIsTrigger(PAD_BUTTON_B)) - { - FADE_OUT_RETURN( TopmenuProcess0 ); - } - - return ImportProcess1; -} - -/*---------------------------------------------------------------------------* - Name: Import プロセス2 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* ImportProcess2(void) -{ - switch( sMenuSelectNo ) - { - case 0: - return ImportAllOverwriteProcess0; - break; - case 1: - return ImportAllNonexistentProcess0; - break; - case 2: - FADE_OUT_RETURN( ImportIndividuallyProcess0 ); - case 3: - FADE_OUT_RETURN( TopmenuProcess0 ); - } - - return ImportProcess1; -} - -/*---------------------------------------------------------------------------* - Name: ImportProcessReturn1 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* ImportProcessReturn1(void) -{ - while(1) - { - kamiPadRead(); - if (kamiPadIsTrigger(PAD_BUTTON_B)) { break; } - } - - FADE_OUT_RETURN( TopmenuProcess0 ); -} - -/*---------------------------------------------------------------------------* - 全ファイルインポートプロセス(上書き) - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Name: 全ファイルImport プロセス0 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -static void* ImportAllOverwriteProcess0(void) -{ - int i; - BOOL result = TRUE; - - kamiFontPrintf(25, 5, FONT_COLOR_BLACK, "WAIT"); - - for (i=0;i 0) - { - gAutoProcessResult[AUTO_PROCESS_MENU_IMPORT_TAD] = AUTO_PROCESS_RESULT_SUCCESS; - FADE_OUT_RETURN( AutoProcess1 ); - } - else - { - gAutoProcessResult[AUTO_PROCESS_MENU_IMPORT_TAD] = AUTO_PROCESS_RESULT_FAILURE; - FADE_OUT_RETURN( AutoProcess2 ); - } - } - - return ImportProcess1; -} - -/*---------------------------------------------------------------------------* - 上書きインポートプロセス(既存ファイルは上書きしない) - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Name: 重複しないファイルImport プロセス0 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -static void* ImportAllNonexistentProcess0(void) -{ - int i; - BOOL result = TRUE; - - kamiFontPrintf(25, 7, FONT_COLOR_BLACK, "WAIT"); - - for (i=0;i VIEW_LINES_MAX) - { - sTadListViewOffset = sFileNum - VIEW_LINES_MAX; - } - else - { - sTadListViewOffset = 0; - } - } - if (sMenuSelectNoIndividually < sTadListViewOffset) - { - sTadListViewOffset--; - } - - DumpTadInfo(); - ShowTadList(); - } - else if ( kamiPadIsRepeatTrigger(PAD_KEY_DOWN) ) - { - if (++sMenuSelectNoIndividually > sFileNum - 1) - { - sMenuSelectNoIndividually = 0; - sTadListViewOffset = 0; - } - if ((sMenuSelectNoIndividually - sTadListViewOffset) > VIEW_LINES_MAX - 1) - { - sTadListViewOffset++; - } - - DumpTadInfo(); - ShowTadList(); - } - - // カーソル配置 - SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + (sMenuSelectNoIndividually - sTadListViewOffset) * DOT_OF_MENU_SPACE_INDIVIDUALLY)); - - // 決定 - if (kamiPadIsTrigger(PAD_BUTTON_A)) - { - return ImportIndividuallyProcess2; - } - // ひとつ前のメニューへ戻る - else if (kamiPadIsTrigger(PAD_BUTTON_B)) - { - FADE_OUT_RETURN( ImportProcess0 ); - } - - return ImportIndividuallyProcess1; -} - -/*---------------------------------------------------------------------------* - Name: 個別Import プロセス2 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -#define THREAD_STACK_SIZE (16*1024) - -void* ImportIndividuallyProcess2(void) -{ - BOOL ret; - - if (STD_GetStringLength(sTitleSortSet[sMenuSelectNoIndividually].path)) - { - // 個別インポート - ret = ImportTad(sTitleSortSet[sMenuSelectNoIndividually].path, TAD_WRITE_OPTION_USER); - } - else - { - // リターン - return ImportProcess0; - } - - // 今回の結果を表示 - if ( ret == TRUE ) - { - kamiFontPrintf(26, (s16)(5+sMenuSelectNoIndividually*CHAR_OF_MENU_SPACE_INDIVIDUALLY), FONT_COLOR_GREEN, "OK"); - } - else - { - kamiFontPrintf(26, (s16)(5+sMenuSelectNoIndividually*CHAR_OF_MENU_SPACE_INDIVIDUALLY), FONT_COLOR_RED, "NG"); - } - - return ImportIndividuallyProcess1; -} - -/*---------------------------------------------------------------------------* - 処理関数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Name: ImportTad - - Description: .tad ファイルインポート - - Arguments: no - - Returns: None. - *---------------------------------------------------------------------------*/ -static BOOL ImportTad(char* file_name, TadWriteOption option) -{ - NAMTadInfo tadInfo; - NAMTitleInfo titleInfoTmp; - char full_path[FS_ENTRY_LONGNAME_MAX+6]; - OSThread thread; - BOOL ret = FALSE; - s32 nam_result; - BOOL overwrite = FALSE; - - // フルパスを作成 - MakeFullPathForSD(file_name, full_path); - - // tadファイルの情報取得 - if (NAM_ReadTadInfo(&tadInfo, full_path) != NAM_OK) - { - return FALSE; - } - - // NANDの情報を取得 - if ( option != TAD_WRITE_OPTION_OVERWRITE && NAM_ReadTitleInfo(&titleInfoTmp, tadInfo.titleInfo.titleId) == NAM_OK ) - { - // NANDに既にインストールされているかどうか確認する - if (tadInfo.titleInfo.titleId == titleInfoTmp.titleId) - { - overwrite = TRUE; - - switch (option) - { - case TAD_WRITE_OPTION_NONEXISTENT: - return TRUE; - case TAD_WRITE_OPTION_USER: - ShowTitleinfoDifference(&titleInfoTmp, &tadInfo.titleInfo); - - kamiFontPrintfConsole(1, "The program has already existed."); - kamiFontPrintfConsole(1, "Do you overwrite ?\n"); - kamiFontPrintfConsole(1, " \n"); - - // フォントスクリーンデータロード - kamiFontLoadScreenData(); - - while(1) - { - kamiPadRead(); - - if (kamiPadIsTrigger(PAD_BUTTON_A)) - { - break; - } - else if (kamiPadIsTrigger(PAD_BUTTON_B)) - { - kamiFontPrintfConsole(CONSOLE_ORANGE, "Import was canceled.\n"); - return TRUE; - } - } - } - } - } - - // NOT_LAUNCH_FLAG または DATA_ONLY_FLAG が立っていないタイトルの場合 - // freeSoftBoxCountに空きがなければインポートしない - if (!(tadInfo.titleInfo.titleId & (TITLE_ID_NOT_LAUNCH_FLAG_MASK | TITLE_ID_DATA_ONLY_FLAG_MASK))) - { - // 上書きインポートの場合はfreeSoftBoxCountはチェックしない - if (!overwrite) - { - u8 installed, free; - if (!NAMUT_GetSoftBoxCount( &installed, &free )) - { - return FALSE; - } - - if (free == 0) - { - kamiFontPrintfConsole(1, "NAND FreeSoftBoxCount == 0"); - return FALSE; - } - } - } - - // ESの仕様で古い e-ticket があると新しい e-ticket を使ったインポートができない - // 暫定対応として該当タイトルを完全削除してからインポートする - nam_result = NAM_DeleteTitleCompletely(tadInfo.titleInfo.titleId); - if ( nam_result != NAM_OK ) - { - kamiFontPrintfConsole(CONSOLE_RED, "Fail! RetCode=%x\n", nam_result); - return FALSE; - } - - // インポート開始フラグを立てる - sNowImport = TRUE; - - // 進捗スレッド作成 - spStack = OS_Alloc(THREAD_STACK_SIZE); - MI_CpuClear8(spStack, THREAD_STACK_SIZE); - OS_CreateThread(&thread, ProgressThread, NULL, - (void*)((u32)spStack + THREAD_STACK_SIZE), THREAD_STACK_SIZE, OS_GetCurrentThread()->priority - 1); - // デストラクタセット - OS_SetThreadDestructor( &thread, Destructor ); - OS_WakeupThreadDirect(&thread); - - // Import開始 - OS_Printf( "Import %s Start.\n", full_path ); - kamiFontPrintfConsole(CONSOLE_ORANGE, "Import %s Start.\n", file_name ); - - nam_result = NAM_ImportTad( full_path ); - - // 進捗スレッドの自力終了を待つ - while (sNowImport){}; - - if ( nam_result == NAM_OK ) - { - kamiFontPrintfConsole(CONSOLE_ORANGE, "Success!\n"); - ret = TRUE; - } - else - { - kamiFontPrintfConsole(CONSOLE_RED, "Fail! RetCode=%d\n", nam_result); - } - - // InstalledSoftBoxCount, FreeSoftBoxCount の値を現在のNANDの状態に合わせて更新します。 - NAMUT_UpdateSoftBoxCount(); - - return ret; -} - -static void Destructor(void* /*arg*/) -{ - OS_Free(spStack); -} - -/*---------------------------------------------------------------------------* - Name: ProgressThread - - Description: .tad ファイルインポートの進捗を表示するスレッド。 - 進捗が100%に達すると処理を抜ける。 - - Arguments: arg - 使用しない。 - - Returns: None. - *---------------------------------------------------------------------------*/ - -static void ProgressThread(void* /*arg*/) -{ - u32 currentSize; - u32 totalSize = 0; - u32 totalSizeBk = 0; - - ProgressInit(); - - while (TRUE) - { - NAM_GetProgress(¤tSize, &totalSize); - - if ((totalSize > 0 && totalSize == currentSize) || totalSizeBk > totalSize) - { - // 既にインポートが終了 - ProgressDraw((f32)1.0); - break; - } - else if (totalSize > 0) - { - ProgressDraw((f32)currentSize/totalSize); - } - - totalSizeBk = totalSize; - - // Vブランク待ち - OS_WaitVBlankIntr(); - } - - sNowImport = FALSE; -} - -/*---------------------------------------------------------------------------* - Name: ShowTadList - - Description: .tad のリストを表示する - - Arguments: arg - 使用しない。 - - Returns: None. - *---------------------------------------------------------------------------*/ -static void ShowTadList(void) -{ - int i; - - // メニュー一覧 - kamiFontPrintf(3, 4, FONT_COLOR_BLACK, "+--------------------+----+"); - if (sFileNum > 15) { sLines = VIEW_LINES_MAX; } - else { sLines = sFileNum; } - for (i=0;icompanyCode); - MI_CpuCopy8( &companyCode, tempOld, sizeof(companyCode) ); - tempOld[sizeof(companyCode)] = NULL; - - // Company Code (sd) - companyCode = MI_SwapEndian16(titleInfoSd->companyCode); - MI_CpuCopy8( &companyCode, tempNew, sizeof(companyCode) ); - tempNew[sizeof(companyCode)] = NULL; - kamiFontPrintfConsole(CONSOLE_ORANGE, "l Company Code l %-2.2s l %-2.2s l", tempOld, tempNew); - - // Game Code (nand) - gameCode = (u32)(titleInfoNand->titleId & 0xffffffff); - gameCode = MI_SwapEndian32(gameCode); - MI_CpuCopy8( &gameCode, tempOld, sizeof(gameCode) ); - tempOld[sizeof(gameCode)] = NULL; - - // Game Code (sd) - gameCode = (u32)(titleInfoSd->titleId & 0xffffffff); - gameCode = MI_SwapEndian32(gameCode); - MI_CpuCopy8( &gameCode, tempNew, sizeof(gameCode) ); - tempNew[sizeof(gameCode)] = NULL; - kamiFontPrintfConsole(CONSOLE_ORANGE, "l Game Code l %-4.4s l %-4.4s l", tempOld, tempNew); - - // Game Version - kamiFontPrintfConsole(CONSOLE_ORANGE, "l Game Version l %-4.4d l %-4.4d l", titleInfoNand->version, titleInfoSd->version ); - kamiFontPrintfConsole(CONSOLE_ORANGE, "+--------------+-------+-------+"); -} - -/*---------------------------------------------------------------------------* - Name: ProgressInit - - Description: インポートの進捗を表示します - - Arguments: - - Returns: None. - *---------------------------------------------------------------------------*/ -void ProgressInit(void) -{ - sCurrentProgress = 0; -} - -/*---------------------------------------------------------------------------* - Name: ProgressDraw - - Description: インポートの進捗を表示します - - Arguments: - - Returns: None. - *---------------------------------------------------------------------------*/ -void ProgressDraw(f32 ratio) -{ - char square[2] = { 0x01, 0x00 }; - u32 temp; - s32 i; - - temp = (u32)(32 * ratio); - if (temp > sCurrentProgress) - { - s32 diff = (s32)(temp - sCurrentProgress); - for (i=0;i -#include -#include -#include -#include "kami_font.h" -#include "kami_pxi.h" -#include "process_topmenu.h" -#include "process_mcu.h" -#include "process_auto.h" -#include "process_fade.h" -#include "cursor.h" -#include "keypad.h" -#include "common_utility.h" - -/*---------------------------------------------------------------------------* - マクロ定義 - *---------------------------------------------------------------------------*/ - -#define ROUND_UP(value, alignment) \ - (((u32)(value) + (alignment-1)) & ~(alignment-1)) - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -#define DOT_OF_MENU_SPACE 8 -#define CHAR_OF_MENU_SPACE 1 -#define CURSOR_ORIGIN_X 32 -#define CURSOR_ORIGIN_Y 40 - -#define FILE_NUM_MAX 16 - -/*---------------------------------------------------------------------------* - 内部変数定義 - *---------------------------------------------------------------------------*/ - -static s8 sMenuSelectNo; -static char sFilePath[FILE_NUM_MAX][FS_ENTRY_LONGNAME_MAX]; -static u8 sFileNum; - -/*---------------------------------------------------------------------------* - 内部関数宣言 - *---------------------------------------------------------------------------*/ - -static BOOL WriteMcuData(char* full_path); - -/*---------------------------------------------------------------------------* - プロセス関数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Name: mcu プロセス0 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* mcuProcess0(void) -{ - FSFile dir; - int i; - - // 文字列全クリア - kamiFontClear(); - - // バージョン表示 - kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Write MCU Data"); - kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); - - // 配列クリア - MI_CpuClear8( sFilePath, sizeof(sFilePath) ); - - // ファイル数初期化 - sFileNum = 0; - - // 背景全クリア - for (i=0;i<24;i++) - { - kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); - } - - // 背景上部 - kamiFontFillChar( 0, BG_COLOR_GRAY, BG_COLOR_GRAY ); - kamiFontFillChar( 1, BG_COLOR_GRAY, BG_COLOR_GRAY ); - kamiFontFillChar( 2, BG_COLOR_GRAY, BG_COLOR_TRANS ); - - // SDカードのルートディレクトリを検索 - if ( !FS_OpenDirectory(&dir, "sdmc:/", FS_FILEMODE_R | FS_FILEMODE_W) ) - { - OS_Printf("Error FS_OpenDirectory(sdmc:/)\n"); - kamiFontPrintf(3, 13, FONT_COLOR_BLACK, "Error FS_OpenDirectory(sdmc:/)"); - } - else - { - FSDirectoryEntryInfo info[1]; - OS_Printf("[%s]:\n", "sdmc:/"); - - kamiFontPrintfConsole(CONSOLE_ORANGE, "------ hex file list -----\n"); - - // .hex を探してファイル名を保存しておく - while (FS_ReadDirectory(&dir, info)) - { - OS_Printf(" %s", info->longname); - if ((info->attributes & (FS_ATTRIBUTE_DOS_DIRECTORY | FS_ATTRIBUTE_IS_DIRECTORY)) != 0) - { - OS_Printf("/\n"); - } - else - { - char* pExtension; - OS_Printf(" (%d BYTEs)\n", info->filesize); - - // 拡張子のチェック - pExtension = STD_SearchCharReverse( info->longname, '.'); - if (pExtension) - { - if (!STD_CompareString( pExtension, ".hex") || !STD_CompareString( pExtension, ".HEX")) - { - STD_CopyString( sFilePath[sFileNum], info->longname ); - kamiFontPrintfConsole(CONSOLE_ORANGE, "%d:%s\n", sFileNum, info->longname); - - // 最大16個で終了 - if (++sFileNum >= FILE_NUM_MAX) - { - break; - } - } - } - } - } - (void)FS_CloseDirectory(&dir); - - kamiFontPrintfConsole(CONSOLE_ORANGE, "--------------------------\n"); - } - - // メニュー一覧 - kamiFontPrintf((s16)3, (s16)4, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf((s16)3, (s16)(5+sFileNum+1), FONT_COLOR_BLACK, "+--------------------+----+"); - - // tad ファイルリストを表示 - for (i=0;i sFileNum) sMenuSelectNo = 0; - } - - // カーソル配置 - SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); - - // 決定 - if (kamiPadIsTrigger(PAD_BUTTON_A)) - { - return mcuProcess2; - } - // トップメニューへ戻る - else if (kamiPadIsTrigger(PAD_BUTTON_B)) - { - FADE_OUT_RETURN( TopmenuProcess0 ); - } - - return mcuProcess1; -} - -/*---------------------------------------------------------------------------* - Name: mcu プロセス2 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* mcuProcess2(void) -{ - BOOL result; - char full_path[FS_ENTRY_LONGNAME_MAX+6]; - - if (STD_GetStringLength(sFilePath[sMenuSelectNo])) - { - kamiFontPrintf((s16)25, (s16)(5+sMenuSelectNo*CHAR_OF_MENU_SPACE), FONT_COLOR_BLACK, "WAIT"); - kamiFontLoadScreenData(); - - // .hexのフルパスを作成 - MakeFullPathForSD(sFilePath[sMenuSelectNo], full_path); - result = WriteMcuData(full_path); - } - else - { - if (gAutoFlag) { FADE_OUT_RETURN( AutoProcess1 ); } - else { FADE_OUT_RETURN( TopmenuProcess0 ); } - } - - // 今回の結果を表示 - if ( result == TRUE ) - { - kamiFontPrintf((s16)25, (s16)(5+sMenuSelectNo*CHAR_OF_MENU_SPACE), FONT_COLOR_GREEN, " OK "); - } - else - { - kamiFontPrintf((s16)25, (s16)(5+sMenuSelectNo*CHAR_OF_MENU_SPACE), FONT_COLOR_RED, " NG "); - } - -#ifndef NAND_INITIALIZER_LIMITED_MODE - // Auto用 - if (gAutoFlag) - { - if (result) - { - gAutoProcessResult[AUTO_PROCESS_MENU_MCU] = AUTO_PROCESS_RESULT_SUCCESS; - FADE_OUT_RETURN( AutoProcess1 ); - } - else - { - gAutoProcessResult[AUTO_PROCESS_MENU_MCU] = AUTO_PROCESS_RESULT_FAILURE; - FADE_OUT_RETURN( AutoProcess2); - } - } -#endif - - return mcuProcess1; -} - -/*---------------------------------------------------------------------------* - 処理関数定義 - *---------------------------------------------------------------------------*/ - -static BOOL WriteMcuData(char* full_path) -{ - FSFile file; - BOOL open_is_ok; - BOOL read_is_ok; - void* pTempBuf; - u32 file_size; - u32 alloc_size; - BOOL result = TRUE; - - // ROMファイルオープン - FS_InitFile(&file); - open_is_ok = FS_OpenFile(&file, full_path); - if (!open_is_ok) - { - OS_Printf("FS_OpenFile(\"%s\") ... ERROR!\n", full_path); - return FALSE; - } - - // ROMファイルリード - file_size = FS_GetFileLength(&file) ; - alloc_size = ROUND_UP(file_size, 32) ; - pTempBuf = OS_Alloc( alloc_size ); - SDK_NULL_ASSERT(pTempBuf); - DC_InvalidateRange(pTempBuf, alloc_size); - read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size ); - if (!read_is_ok) - { - kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_ReadFile(\"%s\") ... ERROR!\n", full_path); - FS_CloseFile(&file); - OS_Free(pTempBuf); - return FALSE; - } - - // ROMファイルクローズ - FS_CloseFile(&file); - - if (kamiMcuWriteFirm(pTempBuf) != KAMI_RESULT_SUCCESS) - { - result = FALSE; - } - - OS_Free(pTempBuf); - - return result; -} - diff --git a/build/tests/TestComponent/ARM9.TWL/src/process_nandfirm.c b/build/tests/TestComponent/ARM9.TWL/src/process_nandfirm.c deleted file mode 100644 index f290ae1f..00000000 --- a/build/tests/TestComponent/ARM9.TWL/src/process_nandfirm.c +++ /dev/null @@ -1,281 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_nandfirm.c - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include -#include -#include -#include -#include -#include "kami_font.h" -#include "kami_pxi.h" -#include "process_topmenu.h" -#include "process_nandfirm.h" -#include "process_import.h" -#include "process_auto.h" -#include "process_fade.h" -#include "cursor.h" -#include "keypad.h" -#include "kami_write_nandfirm.h" -#include "common_utility.h" - -#include "TWLHWInfo_api.h" -#include -#include <../build/libraries/spi/ARM9/include/spi.h> - -/*---------------------------------------------------------------------------* - マクロ定義 - *---------------------------------------------------------------------------*/ - -#define ROUND_UP(value, alignment) \ - (((u32)(value) + (alignment-1)) & ~(alignment-1)) - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -#define DOT_OF_MENU_SPACE 8 -#define CHAR_OF_MENU_SPACE 1 -#define CURSOR_ORIGIN_X 32 -#define CURSOR_ORIGIN_Y 40 - -#define FILE_NUM_MAX 16 - -/*---------------------------------------------------------------------------* - 内部変数定義 - *---------------------------------------------------------------------------*/ - -static s32 sMenuSelectNo; -static char sFilePath[FILE_NUM_MAX][FS_ENTRY_LONGNAME_MAX]; -static u8 sFileNum; - -/*---------------------------------------------------------------------------* - 関数宣言 - *---------------------------------------------------------------------------*/ - -void MakeFullPathForSD(char* file_name, char* full_path); - -/*---------------------------------------------------------------------------* - プロセス関数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Name: Import プロセス0 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* NandfirmProcess0(void) -{ - FSFile dir; - int i; - - // 文字列全クリア - kamiFontClear(); - - // バージョン表示 - kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Import NandFirm from SD"); - kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); - - // 配列クリア - MI_CpuClear8( sFilePath, sizeof(sFilePath) ); - - // ファイル数初期化 - sFileNum = 0; - - // 背景全クリア - for (i=0;i<24;i++) - { - kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); - } - - // 背景上部 - kamiFontFillChar( 0, BG_COLOR_GREEN, BG_COLOR_GREEN ); - kamiFontFillChar( 1, BG_COLOR_GREEN, BG_COLOR_GREEN ); - kamiFontFillChar( 2, BG_COLOR_GREEN, BG_COLOR_TRANS ); - - // SDカードのルートディレクトリを検索 - if ( !FS_OpenDirectory(&dir, "sdmc:/", FS_FILEMODE_R | FS_FILEMODE_W) ) - { - kamiFontPrintfConsole(CONSOLE_RED, "Error FS_OpenDirectory(sdmc:/)"); - } - else - { - FSDirectoryEntryInfo info[1]; - OS_Printf("[%s]:\n", "sdmc:/"); - - kamiFontPrintfConsole(CONSOLE_ORANGE, "------ nand file list -----\n"); - - // .nand を探してファイル名を保存しておく - while (FS_ReadDirectory(&dir, info)) - { - OS_Printf(" %s", info->longname); - if ((info->attributes & (FS_ATTRIBUTE_DOS_DIRECTORY | FS_ATTRIBUTE_IS_DIRECTORY)) != 0) - { - OS_Printf("/\n"); - } - else - { - char* pExtension; - OS_Printf(" (%d BYTEs)\n", info->filesize); - - // 拡張子のチェック - pExtension = STD_SearchCharReverse( info->longname, '.'); - if (pExtension) - { - if (!STD_CompareString( pExtension, ".nand") || !STD_CompareString( pExtension, ".NAND")) - { - STD_CopyString( sFilePath[sFileNum], info->longname ); - kamiFontPrintfConsole(CONSOLE_ORANGE, "%d:%s\n", sFileNum, info->longname); - - // 最大16個で終了 - if (++sFileNum >= FILE_NUM_MAX) - { - break; - } - } - } - } - } - (void)FS_CloseDirectory(&dir); - - kamiFontPrintfConsole(CONSOLE_ORANGE, "--------------------------\n"); - } - - // メニュー一覧 - kamiFontPrintf((s16)3, (s16)4, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf((s16)3, (s16)(5+sFileNum+1), FONT_COLOR_BLACK, "+--------------------+----+"); - - // tad ファイルリストを表示 - for (i=0;i sFileNum) sMenuSelectNo = 0; - } - - // カーソル配置 - SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); - - // 決定 - if (kamiPadIsTrigger(PAD_BUTTON_A)) - { - return NandfirmProcess2; - } - // トップメニューへ戻る - else if (kamiPadIsTrigger(PAD_BUTTON_B)) - { - FADE_OUT_RETURN( TopmenuProcess0 ); - } - - return NandfirmProcess1; -} - -/*---------------------------------------------------------------------------* - Name: プロセス2 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* NandfirmProcess2(void) -{ - BOOL ret; - char full_path[FS_ENTRY_LONGNAME_MAX+6]; - - if (STD_GetStringLength(sFilePath[sMenuSelectNo])) - { - // .nandのフルパスを作成 - MakeFullPathForSD(sFilePath[sMenuSelectNo], full_path); - ret = kamiWriteNandfirm(full_path, OS_AllocFromMain, OS_FreeToMain); - } - else - { - if (gAutoFlag) { FADE_OUT_RETURN( AutoProcess2 ); } - else { FADE_OUT_RETURN( TopmenuProcess0 ); } - } - - // 今回の結果を表示 - if ( ret == TRUE ) - { - kamiFontPrintf((s16)26, (s16)(5+sMenuSelectNo*CHAR_OF_MENU_SPACE), FONT_COLOR_GREEN, "OK"); - } - else - { - kamiFontPrintf((s16)26, (s16)(5+sMenuSelectNo*CHAR_OF_MENU_SPACE), FONT_COLOR_RED, "NG"); - } - - // Auto用 - if (gAutoFlag) - { - if (ret) - { - gAutoProcessResult[AUTO_PROCESS_MENU_IMPORT_NANDFIRM] = AUTO_PROCESS_RESULT_SUCCESS; - FADE_OUT_RETURN( AutoProcess1 ); - } - else - { - gAutoProcessResult[AUTO_PROCESS_MENU_IMPORT_NANDFIRM] = AUTO_PROCESS_RESULT_FAILURE; - FADE_OUT_RETURN( AutoProcess2 ); - } - } - - return NandfirmProcess1; -} diff --git a/build/tests/TestComponent/ARM9.TWL/src/process_norfirm.c b/build/tests/TestComponent/ARM9.TWL/src/process_norfirm.c deleted file mode 100644 index 1f705273..00000000 --- a/build/tests/TestComponent/ARM9.TWL/src/process_norfirm.c +++ /dev/null @@ -1,415 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_norfirm.c - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include -#include -#include -#include -#include -#include -#include -#include "kami_font.h" -#include "kami_pxi.h" -#include "process_topmenu.h" -#include "process_import.h" -#include "process_norfirm.h" -#include "process_fade.h" -#include "cursor.h" -#include "keypad.h" -#include "common_utility.h" -#include "TWLHWInfo_api.h" - -#include -#include -#include <../build/libraries/spi/ARM9/include/spi.h> - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -#define DOT_OF_MENU_SPACE 8 -#define CHAR_OF_MENU_SPACE 1 - -#define CURSOR_ORIGIN_X 32 -#define CURSOR_ORIGIN_Y 40 - -#define FILE_NUM_MAX 16 - -#define ROUND_UP(value, alignment) \ - (((u32)(value) + (alignment-1)) & ~(alignment-1)) - -/*---------------------------------------------------------------------------* - 内部変数定義 - *---------------------------------------------------------------------------*/ - -static s32 sMenuSelectNo; -static char sFilePath[FILE_NUM_MAX][FS_ENTRY_LONGNAME_MAX]; -static u8 sFileNum; - -/*---------------------------------------------------------------------------* - 内部関数宣言 - *---------------------------------------------------------------------------*/ - -static BOOL WriteNorfirm(char* file_name); - -/*---------------------------------------------------------------------------* - プロセス関数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Name: Import プロセス0 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* NorfirmProcess0(void) -{ - FSFile dir; - int i; - - // 文字列全クリア - kamiFontClear(); - - // バージョン表示 - kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Import Norfirm from SD"); - kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); - - // 配列クリア - MI_CpuClear8( sFilePath, sizeof(sFilePath) ); - - // ファイル数初期化 - sFileNum = 0; - - // 背景全クリア - for (i=0;i<24;i++) - { - kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); - } - - // 背景上部 - kamiFontFillChar( 0, BG_COLOR_VIOLET, BG_COLOR_VIOLET ); - kamiFontFillChar( 1, BG_COLOR_VIOLET, BG_COLOR_VIOLET ); - kamiFontFillChar( 2, BG_COLOR_VIOLET, BG_COLOR_TRANS ); - - // SDカードのルートディレクトリを検索 - if ( !FS_OpenDirectory(&dir, "sdmc:/", FS_FILEMODE_R | FS_FILEMODE_W) ) - { - OS_Printf("Error FS_OpenDirectory(sdmc:/)\n"); - kamiFontPrintf(3, 13, FONT_COLOR_BLACK, "Error FS_OpenDirectory(sdmc:/)"); - } - else - { - FSDirectoryEntryInfo info[1]; - OS_Printf("[%s]:\n", "sdmc:/"); - - kamiFontPrintfConsole(0, "------ nor file list -----\n"); - - // .nor を探してファイル名を保存しておく - while (FS_ReadDirectory(&dir, info)) - { - OS_Printf(" %s", info->longname); - if ((info->attributes & (FS_ATTRIBUTE_DOS_DIRECTORY | FS_ATTRIBUTE_IS_DIRECTORY)) != 0) - { - OS_Printf("/\n"); - } - else - { - char* pExtension; - OS_Printf(" (%d BYTEs)\n", info->filesize); - - // 拡張子のチェック - pExtension = STD_SearchCharReverse( info->longname, '.'); - if (pExtension) - { - if (!STD_CompareString( pExtension, ".nor") || !STD_CompareString( pExtension, ".NOR")) - { - STD_CopyString( sFilePath[sFileNum], info->longname ); - kamiFontPrintfConsole(0, "%d:%s\n", sFileNum, info->longname); - - // 最大16個で終了 - if (++sFileNum >= FILE_NUM_MAX) - { - break; - } - } - } - } - } - (void)FS_CloseDirectory(&dir); - - kamiFontPrintfConsole(0, "--------------------------\n"); - } - - // メニュー一覧 - kamiFontPrintf((s16)3, (s16)4, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf((s16)3, (s16)(5+sFileNum+1), FONT_COLOR_BLACK, "+--------------------+----+"); - - // tad ファイルリストを表示 - for (i=0;i sFileNum) sMenuSelectNo = 0; - } - - // カーソル配置 - SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); - - // 決定 - if (kamiPadIsTrigger(PAD_BUTTON_A)) - { - return NorfirmProcess2; - } - // トップメニューへ戻る - else if (kamiPadIsTrigger(PAD_BUTTON_B)) - { - FADE_OUT_RETURN( TopmenuProcess0 ); - } - - return NorfirmProcess1; -} - -/*---------------------------------------------------------------------------* - Name: プロセス2 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* NorfirmProcess2(void) -{ - BOOL ret; - - if (STD_GetStringLength(sFilePath[sMenuSelectNo])) - { - ret = WriteNorfirm(sFilePath[sMenuSelectNo]); - } - else - { - // リターン - FADE_OUT_RETURN( TopmenuProcess0 ); - } - - // 今回の結果を表示 - if ( ret == TRUE ) - { - kamiFontPrintf((s16)26, (s16)(5+sMenuSelectNo*CHAR_OF_MENU_SPACE), FONT_COLOR_GREEN, "OK"); - } - else - { - kamiFontPrintf((s16)26, (s16)(5+sMenuSelectNo*CHAR_OF_MENU_SPACE), FONT_COLOR_RED, "NG"); - } - - return NorfirmProcess1; -} - -/*---------------------------------------------------------------------------* - 処理関数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Name: WriteNorfirm - - Description: - - Arguments: - - Returns: None. - *---------------------------------------------------------------------------*/ -#define NVRAM_PAGE_SIZE 256 - -static BOOL WriteNorfirm(char* file_name) -{ - FSFile file; - char full_path[FS_ENTRY_LONGNAME_MAX+6]; - BOOL open_is_ok; - BOOL read_is_ok; - u8* pTempBuf; - u32 file_size; - u32 alloc_size; - BOOL result = TRUE; - int nor_addr; - u16 crc_w1, crc_w2; - u16 crc_r1, crc_r2; - - // .norのフルパスを作成 - MakeFullPathForSD(file_name, full_path); - - // .norファイルオープン - FS_InitFile(&file); - open_is_ok = FS_OpenFile(&file, full_path); - OS_Printf("FS_OpenFile(\"%s\") ... %s!\n", full_path, open_is_ok ? "OK" : "ERROR"); - - // サイズチェック - file_size = FS_GetFileLength(&file) ; - if (file_size > 256*1024) - { - kamiFontPrintfConsoleEx(1, "too big file size!\n"); - FS_CloseFile(&file); - return FALSE; - } - - // バッファ確保 - alloc_size = ROUND_UP(file_size, 32) ; - pTempBuf = OS_Alloc( alloc_size ); - if (pTempBuf == NULL) - { - kamiFontPrintfConsoleEx(1, "Fail Alloc()\n"); - FS_CloseFile(&file); - return FALSE; - } - - // .norファイルリード - DC_InvalidateRange(pTempBuf, alloc_size); - read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size ); - if (!read_is_ok) - { - kamiFontPrintfConsoleEx(1, "FS_ReadFile(\"%s\") ... ERROR!\n", full_path); - FS_CloseFile(&file); - OS_Free(pTempBuf); - return FALSE; - } - - // ファイルクローズ - FS_CloseFile(&file); - - // 書き込み前のCRCを計算 - DC_StoreRange(pTempBuf, file_size); - crc_w1 = SVC_GetCRC16( 0xffff, pTempBuf, sizeof(NORHeaderDS) ); - crc_w2 = SVC_GetCRC16( 0xffff, pTempBuf+512, file_size-512 ); - - // まずNORHeaderDS領域を書き込む(40byte?) - if (NVRAMi_Write(0, sizeof(NORHeaderDS), (void*)pTempBuf ) != NVRAM_RESULT_SUCCESS) - { - kamiFontPrintfConsoleEx(1, "Fail NVRAMi_Write()\n"); - result = FALSE; - } - - // 読み込みはARM7が直接メモリに書き出す - DC_InvalidateRange(pTempBuf, sizeof(NORHeaderDS)); - - // CRCチェックのためNvramからリード - if (NVRAMi_Read(0, sizeof(NORHeaderDS), pTempBuf) != NVRAM_RESULT_SUCCESS) - { - OS_Printf("NVRAMi_Read ... ERROR!\n"); - } - - // 書き込み後のCRCを計算 - DC_StoreRange(pTempBuf, sizeof(NORHeaderDS)); - crc_r1 = SVC_GetCRC16( 0xffff, pTempBuf, sizeof(NORHeaderDS) ); - - // NVRAM前半部のCRCをチェック - if ( crc_w1 != crc_r1 ) - { - OS_Free(pTempBuf); - kamiFontPrintfConsoleEx(1, "Fail! CRC check %x!=%x\n", crc_w1, crc_r1); - return FALSE; - } - - nor_addr = offsetof(NORHeader, l); // 512byte - - // 進捗メーター初期化 - ProgressInit(); - kamiFontPrintfConsole(0, "NOR Firm Import Start!\n"); - - while ( nor_addr < file_size) - { - // 書きこみ - if (NVRAMi_Write((u32)nor_addr, NVRAM_PAGE_SIZE, (void*)(pTempBuf + nor_addr)) != NVRAM_RESULT_SUCCESS) - { - OS_TPrintf("======= Fail NVRAMi_Write() ======== \n"); - result = FALSE; - break; - } - nor_addr += NVRAM_PAGE_SIZE; - - // 進捗メーター表示 - ProgressDraw((f32)nor_addr/file_size); - } - - kamiFontPrintfConsoleEx(0, "Start CRC check\n"); - kamiFontLoadScreenData(); - - // 読み込みはARM7が直接メモリに書き出す - DC_InvalidateRange(pTempBuf, file_size); - - // CRCチェックのためNvramからリード - if (NVRAMi_Read(0, file_size, pTempBuf ) != NVRAM_RESULT_SUCCESS) - { - OS_Printf("kamiNvramRead ... ERROR!\n"); - } - - // 書き込み後のCRCを計算 - DC_StoreRange(pTempBuf, file_size); - crc_r2 = SVC_GetCRC16( 0xffff, pTempBuf+512, file_size-512 ); - - // CRC比較 - if (crc_w2 != crc_r2) - { - result = FALSE; - kamiFontPrintfConsoleEx(1, "Fail! CRC check %x!=%x\n", crc_w2, crc_r2); - } - - // メモリ解放 - OS_Free(pTempBuf); - - return result; -} - - - diff --git a/build/tests/TestComponent/ARM9.TWL/src/process_topmenu.c b/build/tests/TestComponent/ARM9.TWL/src/process_topmenu.c deleted file mode 100644 index f9e7d167..00000000 --- a/build/tests/TestComponent/ARM9.TWL/src/process_topmenu.c +++ /dev/null @@ -1,255 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_topmenu.c - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include -#include "kami_font.h" -#include "process_topmenu.h" -#include "process_format.h" -#include "process_hw_info.h" -#include "process_import.h" -#include "process_nandfirm.h" -#include "process_norfirm.h" -#include "process_auto.h" -#include "process_fade.h" -#include "process_wireless_setting.h" -#include "process_write_data.h" -#include "process_mcu.h" -#include "cursor.h" -#include "keypad.h" - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -enum { - MENU_FORMAT = 0, - MENU_HARDWARE_INFO, - -#ifdef USE_WIRELESS_FORCE_DISABLE_SETTING - MENU_WIRELESS_SETTING, -#endif // USE_WIRELESS_FORCE_DISABLE_SETTING - -#ifdef USE_WRITE_VARIOUS_DATA - MENU_WRITE_DATA, -#endif // USE_WRITE_VARIOUS_DATA - -#ifndef NAND_INITIALIZER_LIMITED_MODE - MENU_IMPORT_TAD, - MENU_IMPORT_NANDFIRM, - MENU_IMPORT_NORFIRM, - MENU_WRITE_MCU_DATA, -#endif // NAND_INITIALIZER_LIMITED_MODE - NUM_OF_MENU_SELECT -}; - -typedef struct _MenuAndColor -{ - char* menu_name; - u8 color; -} MenuAndColor; - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -#define DOT_OF_MENU_SPACE 16 -#define CURSOR_ORIGIN_X 32 -#define CURSOR_ORIGIN_Y 56 -#define MENU_TOP_LINE 7 -#define CHAR_OF_MENU_SPACE 2 - -static const MenuAndColor sMenuArray[] = -{ - {" FORMAT NAND ", BG_COLOR_BLUE }, - {" WRITE HARDWARE INFO ", BG_COLOR_PURPLE }, - -#ifdef USE_WIRELESS_FORCE_DISABLE_SETTING - {" WIRELESS FORCE SETTING ", BG_COLOR_YELLOW }, -#endif // USE_WIRELESS_FORCE_DISABLE_SETTING - -#ifdef USE_WRITE_VARIOUS_DATA - {" WRITE VARIOUS DATA ", BG_COLOR_BROWN }, -#endif // USE_WRITE_VARIOUS_DATA - -#ifndef NAND_INITIALIZER_LIMITED_MODE - {" IMPORT TAD FROM SD ", BG_COLOR_PINK }, - {" IMPORT NANDFIRM FROM SD", BG_COLOR_GREEN }, - {" IMPORT NORFIRM FROM SD", BG_COLOR_VIOLET }, - {" WRITE MCU DATA ", BG_COLOR_GRAY } -#endif // NAND_INITIALIZER_LIMITED_MODE -}; - -/*---------------------------------------------------------------------------* - 内部変数定義 - *---------------------------------------------------------------------------*/ - -static s8 sMenuSelectNo; - -/*---------------------------------------------------------------------------* - 内部関数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - プロセス関数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Name: Top Menu プロセス0 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* TopmenuProcess0(void) -{ - int i; - - // 文字列全クリア - kamiFontClear(); - - // バージョン表示 -#ifndef NAND_INITIALIZER_LIMITED_MODE - kamiFontPrintf(7, 2, 0, "Nand Initializer RED"); -#else - kamiFontPrintf(8, 2, 0, "Nand Initializer"); -#endif - kamiFontPrintf(9, 4, 8, "<%s>", __DATE__); - - // 背景全クリア - for (i=0;i<24;i++) - { - kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); - } - - for (i=0;i= NUM_OF_MENU_SELECT) sMenuSelectNo = 0; - } - - // カーソル配置 - SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); - - // 決定 - if (kamiPadIsTrigger(PAD_BUTTON_A)) - { - return TopmenuProcess2; - } - -#ifdef USE_FOR_NIGHTLY_AUTO_TEST - FADE_OUT_RETURN( FormatProcess0 ); -#endif //USE_FOR_NIGHTLY_AUTO_TEST - -#ifndef NAND_INITIALIZER_LIMITED_MODE - -#ifdef AUTO_FORMAT_MODE - FADE_OUT_RETURN( AutoProcess0 ); -#endif - - // L&R同時押しでオート実行! - if (kamiPadIsPress(PAD_BUTTON_L) && kamiPadIsPress(PAD_BUTTON_R)) - { - FADE_OUT_RETURN( AutoProcess0 ); - } -#endif // NAND_INITIALIZER_LIMITED_MODE - - return TopmenuProcess1; -} - -/*---------------------------------------------------------------------------* - Name: Top Menu プロセス2 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* TopmenuProcess2(void) -{ - -#ifndef TWL_CAPTURE_VERSION - switch ( sMenuSelectNo ) - { - case MENU_FORMAT: - FADE_OUT_RETURN( FormatProcess0 ); - case MENU_HARDWARE_INFO: - FADE_OUT_RETURN( HWInfoProcess0 ); -#ifdef USE_WIRELESS_FORCE_DISABLE_SETTING - case MENU_WIRELESS_SETTING: - FADE_OUT_RETURN( WirelessSettingProcess0 ); -#endif // USE_WIRELESS_FORCE_DISABLE_SETTING - -#ifdef USE_WRITE_VARIOUS_DATA - case MENU_WRITE_DATA: - FADE_OUT_RETURN( WriteDataProcess0 ); -#endif // USE_WRITE_VARIOUS_DATA - -#ifndef NAND_INITIALIZER_LIMITED_MODE - case MENU_IMPORT_TAD: - FADE_OUT_RETURN( ImportProcess0 ); - case MENU_IMPORT_NANDFIRM: - FADE_OUT_RETURN( NandfirmProcess0 ); - case MENU_IMPORT_NORFIRM: - FADE_OUT_RETURN( NorfirmProcess0 ); - case MENU_WRITE_MCU_DATA: - FADE_OUT_RETURN( mcuProcess0 ); -#endif // NAND_INITIALIZER_LIMITED_MODE - } -#endif // TWL_CAPTURE_VERSION - return TopmenuProcess1; -} - -/*---------------------------------------------------------------------------* - 処理関数定義 - *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/src/process_wireless_setting.c b/build/tests/TestComponent/ARM9.TWL/src/process_wireless_setting.c deleted file mode 100644 index 855dc8c5..00000000 --- a/build/tests/TestComponent/ARM9.TWL/src/process_wireless_setting.c +++ /dev/null @@ -1,211 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_wireless_setting.c - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include -#include -#include "kami_font.h" -#include "process_topmenu.h" -#include "process_hw_info.h" -#include "process_wireless_setting.h" -#include "process_fade.h" -#include "cursor.h" -#include "keypad.h" -#include "hwi.h" - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -enum { - MENU_WIRELESS_ENABLE, - MENU_WIRELESS_FORCE_OFF, - MENU_RETURN, - NUM_OF_MENU_SELECT -}; - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -#define DOT_OF_MENU_SPACE 16 -#define CHAR_OF_MENU_SPACE 2 -#define MENU_TOP_LINE 5 -#define CURSOR_ORIGIN_X 32 -#define CURSOR_ORIGIN_Y 40 - -/*---------------------------------------------------------------------------* - 内部変数定義 - *---------------------------------------------------------------------------*/ - -static s8 sMenuSelectNo; - -/*---------------------------------------------------------------------------* - 内部関数宣言 - *---------------------------------------------------------------------------*/ - -static BOOL WriteHWNormalInfoFile( void ); -static BOOL WriteHWSecureInfoFile( u8 region ); - -const LCFGTWLHWNormalInfo *LCFG_THW_GetDefaultNormalInfo( void ); -const LCFGTWLHWSecureInfo *LCFG_THW_GetDefaultSecureInfo( void ); -const LCFGTWLHWNormalInfo *LCFG_THW_GetNormalInfo( void ); -const LCFGTWLHWSecureInfo *LCFG_THW_GetSecureInfo( void ); - -/*---------------------------------------------------------------------------* - プロセス関数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Name: WirelessSetting プロセス0 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* WirelessSettingProcess0(void) -{ - int i; - - // 文字列全クリア - kamiFontClear(); - - // バージョン表示 - kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Wireless Setting "); - kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); - - // メニュー一覧 - kamiFontPrintf(3, 4, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf(3, 5, FONT_COLOR_BLACK, "l Wireless Enable l l"); - kamiFontPrintf(3, 6, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf(3, 7, FONT_COLOR_BLACK, "l Wireless Force Offl l"); - kamiFontPrintf(3, 8, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf(3, 9, FONT_COLOR_BLACK, "l RETURN l l"); - kamiFontPrintf(3, 10, FONT_COLOR_BLACK, "+--------------------+----+"); - - // 現在の無線強制OFF状態に"now"と表示 - kamiFontPrintf(26, (s16)(MENU_TOP_LINE+LCFG_THW_IsForceDisableWireless()*CHAR_OF_MENU_SPACE), FONT_COLOR_BLACK, "now"); - - // 背景全クリア - for (i=0;i<24;i++) - { - kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); - } - - // 背景上部 - kamiFontFillChar( 0, BG_COLOR_YELLOW, BG_COLOR_YELLOW ); - kamiFontFillChar( 1, BG_COLOR_YELLOW, BG_COLOR_YELLOW ); - kamiFontFillChar( 2, BG_COLOR_YELLOW, BG_COLOR_TRANS ); - - // カーソル除外 - SetCursorPos((u16)200, (u16)200); - - FADE_IN_RETURN( WirelessSettingProcess1 ); -} - -/*---------------------------------------------------------------------------* - Name: WirelessSetting プロセス1 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* WirelessSettingProcess1(void) -{ - // 選択メニューの変更 - if ( kamiPadIsRepeatTrigger(PAD_KEY_UP) ) - { - if (--sMenuSelectNo < 0) sMenuSelectNo = NUM_OF_MENU_SELECT -1; - } - else if ( kamiPadIsRepeatTrigger(PAD_KEY_DOWN) ) - { - if (++sMenuSelectNo >= NUM_OF_MENU_SELECT) sMenuSelectNo = 0; - } - - // カーソル配置 - SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); - - // 決定 - if (kamiPadIsTrigger(PAD_BUTTON_A)) - { - return WirelessSettingProcess2; - } - // トップメニューへ戻る - else if (kamiPadIsTrigger(PAD_BUTTON_B)) - { - FADE_OUT_RETURN( TopmenuProcess0 ); - } - - return WirelessSettingProcess1; -} - -/*---------------------------------------------------------------------------* - Name: WirelessSetting プロセス2 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* WirelessSettingProcess2(void) -{ - BOOL result; - - switch( sMenuSelectNo ) - { - case MENU_WIRELESS_ENABLE: - result = WriteHWInfoFile( OS_GetRegion(), FALSE ); - if ( result == TRUE ) - { - kamiFontPrintf(26, (s16)(MENU_TOP_LINE+MENU_WIRELESS_ENABLE*CHAR_OF_MENU_SPACE), FONT_COLOR_GREEN, "OK "); - kamiFontPrintf(26, (s16)(MENU_TOP_LINE+MENU_WIRELESS_FORCE_OFF*CHAR_OF_MENU_SPACE), FONT_COLOR_GREEN, " "); - } - else - { - kamiFontPrintf(26, (s16)(MENU_TOP_LINE+MENU_WIRELESS_ENABLE*CHAR_OF_MENU_SPACE), FONT_COLOR_GREEN, "NG "); - kamiFontPrintf(26, (s16)(MENU_TOP_LINE+MENU_WIRELESS_FORCE_OFF*CHAR_OF_MENU_SPACE), FONT_COLOR_GREEN, " "); - } - break; - - case MENU_WIRELESS_FORCE_OFF: - result = WriteHWInfoFile( OS_GetRegion(), TRUE ); - if ( result == TRUE ) - { - kamiFontPrintf(26, (s16)(MENU_TOP_LINE+MENU_WIRELESS_ENABLE*CHAR_OF_MENU_SPACE), FONT_COLOR_GREEN, " "); - kamiFontPrintf(26, (s16)(MENU_TOP_LINE+MENU_WIRELESS_FORCE_OFF*CHAR_OF_MENU_SPACE), FONT_COLOR_GREEN, "OK "); - } - else - { - kamiFontPrintf(26, (s16)(MENU_TOP_LINE+MENU_WIRELESS_ENABLE*CHAR_OF_MENU_SPACE), FONT_COLOR_GREEN, " "); - kamiFontPrintf(26, (s16)(MENU_TOP_LINE+MENU_WIRELESS_FORCE_OFF*CHAR_OF_MENU_SPACE), FONT_COLOR_GREEN, "NG "); - } - break; - - case MENU_RETURN: - FADE_OUT_RETURN( TopmenuProcess0 ); - break; - } - - return WirelessSettingProcess1; -} diff --git a/build/tests/TestComponent/ARM9.TWL/src/process_write_data.c b/build/tests/TestComponent/ARM9.TWL/src/process_write_data.c deleted file mode 100644 index d29b373e..00000000 --- a/build/tests/TestComponent/ARM9.TWL/src/process_write_data.c +++ /dev/null @@ -1,481 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: process_write_data.c - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include -#include -#include -#include -#include "kami_font.h" -#include "kami_pxi.h" -#include "process_topmenu.h" -#include "process_write_data.h" -#include "process_auto.h" -#include "process_fade.h" -#include "cursor.h" -#include "keypad.h" -#include "common_utility.h" - -/*---------------------------------------------------------------------------* - 型定義 - *---------------------------------------------------------------------------*/ - -enum { - MENU_FONT=0, - MENU_WRAP, - MENU_CERT, -#ifdef WRITE_DEVKP_ENABLE - MENU_DEVKP, -#endif - MENU_RETURN, - NUM_OF_MENU_SELECT -}; - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -#define DOT_OF_MENU_SPACE 16 -#define CURSOR_ORIGIN_X 32 -#define CURSOR_ORIGIN_Y 56 -#define CHAR_OF_MENU_SPACE 2 - -#define ROUND_UP(value, alignment) \ - (((u32)(value) + (alignment-1)) & ~(alignment-1)) - -/*---------------------------------------------------------------------------* - 内部変数定義 - *---------------------------------------------------------------------------*/ - -static s8 sMenuSelectNo; - -/*---------------------------------------------------------------------------* - 内部関数宣言 - *---------------------------------------------------------------------------*/ - -static BOOL WriteFontData(void); -static BOOL WriteDummyData(const char* nandpath); -static BOOL WriteCertData(void); - -/*---------------------------------------------------------------------------* - プロセス関数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Name: WriteData プロセス0 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* WriteDataProcess0(void) -{ - int i; - - // 文字列全クリア - kamiFontClear(); - - // バージョン表示 - kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Write Various Data"); - kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); - - // メニュー一覧 - kamiFontPrintf(3, 6, FONT_COLOR_BLACK, "+-------------------+-----+"); - kamiFontPrintf(3, 7, FONT_COLOR_BLACK, "l WRITE FONT DATA l l"); - kamiFontPrintf(3, 8, FONT_COLOR_BLACK, "+-------------------+-----+"); - kamiFontPrintf(3, 9, FONT_COLOR_BLACK, "l WRITE WRAP DATA l l"); - kamiFontPrintf(3, 10, FONT_COLOR_BLACK, "+-------------------+-----+"); - kamiFontPrintf(3, 11, FONT_COLOR_BLACK, "l WRITE CERT.SYS l l"); - kamiFontPrintf(3, 12, FONT_COLOR_BLACK, "+-------------------+-----+"); -#ifdef WRITE_DEVKP_ENABLE - kamiFontPrintf(3, 13, FONT_COLOR_BLACK, "l WRITE DEV.KP l l"); - kamiFontPrintf(3, 14, FONT_COLOR_BLACK, "+-------------------+-----+"); - kamiFontPrintf(3, 15, FONT_COLOR_BLACK, "l RETURN l l"); - kamiFontPrintf(3, 16, FONT_COLOR_BLACK, "+-------------------+-----+"); -#else - kamiFontPrintf(3, 13, FONT_COLOR_BLACK, "l RETURN l l"); - kamiFontPrintf(3, 14, FONT_COLOR_BLACK, "+-------------------+-----+"); -#endif - - // 背景全クリア - for (i=0;i<24;i++) - { - kamiFontFillChar( i, BG_COLOR_TRANS, BG_COLOR_TRANS ); - } - - // 背景上部 - kamiFontFillChar( 0, BG_COLOR_BROWN, BG_COLOR_BROWN ); - kamiFontFillChar( 1, BG_COLOR_BROWN, BG_COLOR_BROWN ); - kamiFontFillChar( 2, BG_COLOR_BROWN, BG_COLOR_TRANS ); - - // カーソル消去 - SetCursorPos((u16)200, (u16)200); - - FADE_IN_RETURN( WriteDataProcess1 ); -} - -/*---------------------------------------------------------------------------* - Name: WriteData プロセス1 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* WriteDataProcess1(void) -{ -#ifndef NAND_INITIALIZER_LIMITED_MODE - // オート実行用 - if (gAutoFlag) - { - sMenuSelectNo = MENU_FONT; - return WriteDataProcess2; - } -#endif - - // 選択メニューの変更 - if ( kamiPadIsRepeatTrigger(PAD_KEY_UP) ) - { - if (--sMenuSelectNo < 0) sMenuSelectNo = NUM_OF_MENU_SELECT -1; - } - else if ( kamiPadIsRepeatTrigger(PAD_KEY_DOWN) ) - { - if (++sMenuSelectNo >= NUM_OF_MENU_SELECT) sMenuSelectNo = 0; - } - - // カーソル配置 - SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); - - // 決定 - if (kamiPadIsTrigger(PAD_BUTTON_A)) - { - return WriteDataProcess2; - } - // トップメニューへ戻る - else if (kamiPadIsTrigger(PAD_BUTTON_B)) - { - FADE_OUT_RETURN( TopmenuProcess0 ); - } - - return WriteDataProcess1; -} - -/*---------------------------------------------------------------------------* - Name: WriteData プロセス2 - - Description: - - Arguments: None. - - Returns: next sequence - *---------------------------------------------------------------------------*/ - -void* WriteDataProcess2(void) -{ - BOOL result; - s16 y_pos = (s16)(7 + sMenuSelectNo * CHAR_OF_MENU_SPACE); - - switch( sMenuSelectNo ) - { - case MENU_FONT: - result = WriteFontData(); - break; - case MENU_WRAP: - // ダミーのDSメニューラッピング用ファイル作成(UIGランチャーが作っているもの) - result = WriteDummyData(WRAP_DATA_FILE_PATH_IN_NAND); - break; - case MENU_CERT: - result = WriteCertData(); - break; -#ifdef WRITE_DEVKP_ENABLE - case MENU_DEVKP: - result = WriteDummyData(DEVKP_DATA_FILE_PATH_IN_NAND); - break; -#endif - case MENU_RETURN: - FADE_OUT_RETURN( TopmenuProcess0 ); - } - - if (result) - { - kamiFontPrintf(25, y_pos, FONT_COLOR_GREEN, "OK"); - } - else - { - kamiFontPrintf(25, y_pos, FONT_COLOR_RED, "NG"); - } - -#ifndef NAND_INITIALIZER_LIMITED_MODE - // Auto用 - if (gAutoFlag) - { - static BOOL total_result = TRUE; - total_result &= result; - - switch(sMenuSelectNo) - { - case MENU_FONT: - case MENU_WRAP: -#ifdef MARIOCLUB_VERSION - sMenuSelectNo++; - return WriteDataProcess2; -#endif //MARIOCLUB_VERSION - case MENU_CERT: -#ifdef WRITE_DEVKP_ENABLE - sMenuSelectNo = MENU_DEVKP; - return WriteDataProcess2; - case MENU_DEVKP: -#endif //WRITE_DEVKP_ENABLE - if (total_result) - { - gAutoProcessResult[AUTO_PROCESS_MENU_VARIOUS_DATA] = AUTO_PROCESS_RESULT_SUCCESS; - FADE_OUT_RETURN( AutoProcess1 ); - } - else - { - gAutoProcessResult[AUTO_PROCESS_MENU_VARIOUS_DATA] = AUTO_PROCESS_RESULT_FAILURE; - FADE_OUT_RETURN( AutoProcess2); - } - } - } -#endif - - return WriteDataProcess1; -} - -/*---------------------------------------------------------------------------* - 処理関数定義 - *---------------------------------------------------------------------------*/ - -static BOOL WriteFontData(void) -{ - FSFile dir, file; - BOOL open_is_ok; - BOOL read_is_ok; - void* pTempBuf; - u32 file_size; - u32 alloc_size; - BOOL result = TRUE; - char full_path[FS_ENTRY_LONGNAME_MAX+6]; - - FS_InitFile(&dir); - - // SDカードのルートディレクトリを検索 - if ( !FS_OpenDirectory(&dir, "sdmc:/", FS_FILEMODE_R) ) - { - kamiFontPrintfConsole(CONSOLE_RED, "Error FS_OpenDirectory(sdmc:/)"); - } - else - { - FSDirectoryEntryInfo info[1]; - - // .dat を探す - while (FS_ReadDirectory(&dir, info)) - { - if ((info->attributes & (FS_ATTRIBUTE_DOS_DIRECTORY | FS_ATTRIBUTE_IS_DIRECTORY)) == 0) - { - char* pExtension; - - // 拡張子のチェック - pExtension = STD_SearchCharReverse( info->longname, '.'); - if (pExtension) - { - if (!STD_CompareString( pExtension, ".dat") || !STD_CompareString( pExtension, ".DAT")) - { - if (!STD_CompareNString(info->longname, "TWLFontTable", STD_GetStringLength("TWLFontTable"))) - { - MakeFullPathForSD(info->longname, full_path); - break; - } - } - } - } - } - (void)FS_CloseDirectory(&dir); - } - - // ROMファイルオープン - FS_InitFile(&file); - open_is_ok = FS_OpenFile(&file, full_path); - if (!open_is_ok) - { - kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_OpenFile(\"%s\") ... ERROR!\n", full_path); - return FALSE; - } - - // ROMファイルリード - file_size = FS_GetFileLength(&file) ; - alloc_size = ROUND_UP(file_size, 32) ; - pTempBuf = OS_Alloc( alloc_size ); - SDK_NULL_ASSERT(pTempBuf); - DC_InvalidateRange(pTempBuf, alloc_size); - read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size ); - if (!read_is_ok) - { - kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_ReadFile(\"%s\") ... ERROR!\n", full_path); - FS_CloseFile(&file); - OS_Free(pTempBuf); - return FALSE; - } - - // ROMファイルクローズ - FS_CloseFile(&file); - - // 一旦フォントデータを削除する - (void)FS_DeleteFile(FONT_DATA_FILE_PATH_IN_NAND); - - // nand:sys/TWLFontTable.dat作成 - if (!FS_CreateFile(FONT_DATA_FILE_PATH_IN_NAND, FS_PERMIT_R | FS_PERMIT_W)) - { - kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_CreateFile(%s) failed.\n", FONT_DATA_FILE_PATH_IN_NAND); - result = FALSE; - } - else - { - // nand:sys/TWLFontTable.datオープン - FS_InitFile(&file); - open_is_ok = FS_OpenFileEx(&file, FONT_DATA_FILE_PATH_IN_NAND, FS_FILEMODE_W); - if (!open_is_ok) - { - kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_OpenFile(%s) failed.\n", FONT_DATA_FILE_PATH_IN_NAND); - result = FALSE; - } - // nand:sys/TWLFontTable.dat書き込み - else if (FS_WriteFile(&file, pTempBuf, (s32)file_size) == -1) - { - kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_WritFile() failed.\n"); - result = FALSE; - } - (void)FS_CloseFile(&file); - } - - OS_Free(pTempBuf); - - return result; -} - -// ダミーファイル作成 -static BOOL WriteDummyData(const char* nandpath) -{ - FSFile file; - BOOL open_is_ok; - const int FATFS_CLUSTER_SIZE = 16 * 1024; - - // 既に存在するなら何もしない - FS_InitFile(&file); - open_is_ok = FS_OpenFile(&file, nandpath); - if (open_is_ok) - { - FS_CloseFile(&file); - OS_Printf("%s is already exist.\n", nandpath); - return TRUE; - } - - if( FS_CreateFileAuto( nandpath, FS_PERMIT_R | FS_PERMIT_W ) ) - { - FSFile file; - if( FS_OpenFileEx( &file, nandpath, FS_FILEMODE_RW ) ) - { - (void)FS_SetFileLength( &file, FATFS_CLUSTER_SIZE ); - FS_CloseFile( &file ); - return TRUE; - } - } - - return FALSE; -} - -static BOOL WriteCertData(void) -{ - FSFile file; - BOOL open_is_ok; - BOOL read_is_ok; - void* pTempBuf; - u32 file_size; - u32 alloc_size; - BOOL result = TRUE; - - // nand:/sys/cert.sysが既に存在するなら何もしない - FS_InitFile(&file); - open_is_ok = FS_OpenFile(&file, CERT_DATA_FILE_PATH_IN_NAND); - if (open_is_ok) - { - FS_CloseFile(&file); - OS_Printf("%s is already exist.\n", CERT_DATA_FILE_PATH_IN_NAND); - return TRUE; - } - - // ROMファイルオープン - FS_InitFile(&file); - open_is_ok = FS_OpenFile(&file, CERT_DATA_FILE_PATH_IN_ROM); - if (!open_is_ok) - { - OS_Printf("FS_OpenFile(\"%s\") ... ERROR!\n", CERT_DATA_FILE_PATH_IN_ROM); - return FALSE; - } - - // ROMファイルリード - file_size = FS_GetFileLength(&file) ; - alloc_size = ROUND_UP(file_size, 32) ; - pTempBuf = OS_Alloc( alloc_size ); - SDK_NULL_ASSERT(pTempBuf); - DC_InvalidateRange(pTempBuf, alloc_size); - read_is_ok = FS_ReadFile( &file, pTempBuf, (s32)file_size ); - if (!read_is_ok) - { - kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_ReadFile(\"%s\") ... ERROR!\n", CERT_DATA_FILE_PATH_IN_ROM); - FS_CloseFile(&file); - OS_Free(pTempBuf); - return FALSE; - } - - // ROMファイルクローズ - FS_CloseFile(&file); - - // nand:sys/cert.sys作成 - if (!FS_CreateFile(CERT_DATA_FILE_PATH_IN_NAND, FS_PERMIT_R | FS_PERMIT_W)) - { - kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_CreateFile(%s) failed.\n", CERT_DATA_FILE_PATH_IN_NAND); - result = FALSE; - } - else - { - // nand:sys/cert.sysオープン - FS_InitFile(&file); - open_is_ok = FS_OpenFileEx(&file, CERT_DATA_FILE_PATH_IN_NAND, FS_FILEMODE_W); - if (!open_is_ok) - { - kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_OpenFile(%s) failed.\n", CERT_DATA_FILE_PATH_IN_NAND); - result = FALSE; - } - // nand:sys/cert.sys書き込み - else if (FS_WriteFile(&file, pTempBuf, (s32)file_size) == -1) - { - kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_WritFile() failed.\n"); - result = FALSE; - } - (void)FS_CloseFile(&file); - } - - OS_Free(pTempBuf); - - return result; -} diff --git a/build/tests/TestComponent/ARM9.TWL/src/sort_title.c b/build/tests/TestComponent/ARM9.TWL/src/sort_title.c deleted file mode 100644 index 9f7caf5a..00000000 --- a/build/tests/TestComponent/ARM9.TWL/src/sort_title.c +++ /dev/null @@ -1,86 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlSDK - NandInitializer - File: sort_title.c - - Copyright 2008 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. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include "sort_title.h" - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - 定数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - 内部変数定義 - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - 関数定義 - *---------------------------------------------------------------------------*/ - -// ソート用 Compare 関数 -static s32 TitleCompareFunc(void *elem1, void *elem2) -{ - TitleSortSet *ipp1 = (TitleSortSet *)elem1; - TitleSortSet *ipp2 = (TitleSortSet *)elem2; - u32 titleID_lo1 = (u32)(0xffffffff & ipp1->titleID); - u32 titleID_lo2 = (u32)(0xffffffff & ipp2->titleID); - BOOL isSystem1 = (u32)( 0x1 & ( ipp1->titleID >> 32 ) ) ? TRUE : FALSE; - BOOL isSystem2 = (u32)( 0x1 & ( ipp2->titleID >> 32 ) ) ? TRUE : FALSE; - BOOL isH1 = ( (u8)( 0xff & ( titleID_lo1 >> 24 ) ) == 'H' ) ? TRUE : FALSE; - BOOL isH2 = ( (u8)( 0xff & ( titleID_lo2 >> 24 ) ) == 'H' ) ? TRUE : FALSE; - - if( isSystem1 && !isSystem2 ) - { - // 要素1が System であり、要素2が System でない場合、要素1が前 (-1) - return -1; - }else if( !isSystem1 && isSystem2 ) - { - // 要素1が System でなく、要素2が System である場合、要素1が後 (1) - return 1; - }else if( isH1 && !isH2 ) - { - // 要素1が "H***" であり、要素2が "H***" でない場合、要素1が前 (-1) - return -1; - }else if( !isH1 && isH2 ) - { - // 要素1が "H***" でなく、要素2が "H***" である場合、要素1が後 (1) - return 1; - }else - { - // その他の場合、titleID_loの小さいほうが前 - return ( titleID_lo1 > titleID_lo2 ) ? - 1 : - ( (titleID_lo1 < titleID_lo2) ? -1 : 0 ); - } - -} - -// TitleSortSet の配列をある法則にしたがってソートします。 -// 内部で MATH_QSort を使用しているので、MATH_QSortStackSize() 関数で取得できる -// サイズの作業バッファを buf に与える必要があります。 -// このサイズは (log2(num)+1) * 8 byte となっています。 -// 作業バッファを渡さない場合には、スタックからこのサイズの作業領域が確保されます。 -// -// info ソートする TitleSortSet 配列の先頭アドレス -// num ソートする配列の要素数 -// buf 作業バッファ -void SortTitle( TitleSortSet *info, u32 num, void *buf ) -{ - MATH_QSort( info, num, sizeof(TitleSortSet), TitleCompareFunc, buf ); -} \ No newline at end of file diff --git a/build/tests/TestComponent/data/cert.sys b/build/tests/TestComponent/data/cert.sys deleted file mode 100644 index 3d40f56a..00000000 Binary files a/build/tests/TestComponent/data/cert.sys and /dev/null differ diff --git a/build/tests/UjiPackage/Makefile b/build/tests/UjiPackage/Makefile index fdb2bc87..9b70d85c 100644 --- a/build/tests/UjiPackage/Makefile +++ b/build/tests/UjiPackage/Makefile @@ -74,17 +74,25 @@ PACKAGE_TMP ?= ./TwlIPL .PHONY: package package: - @echo --- $@ ---; \ + @echo --- Copy sources ---; \ + mkdir -p $(PACKAGE_TMP); \ + mkdir -p $(PACKAGE_TMP)/build; \ + mkdir -p $(PACKAGE_TMP)/build/tests; \ + mkdir -p $(PACKAGE_TMP)/build/systemMenu_tools; \ + $(CP) $(TWL_IPL_RED_ROOT)/build/tests/TestComponent $(PACKAGE_TMP)/build/tests/TestComponent; \ + $(CP) $(TWL_IPL_RED_ROOT)/build/systemMenu_tools/common $(PACKAGE_TMP)/build/systemMenu_tools/common; \ + echo --- Build TwlIPL ---; \ + $(MAKE) full; \ + echo --- Packaging ---; \ mkdir -p $(PACKAGE_TMP); \ $(CP) $(TWL_IPL_RED_ROOT)/setup $(PACKAGE_TMP)/setup; \ - mkdir -p $(PACKAGE_TMP)/lib; \ - $(CP) $(TWL_IPL_RED_ROOT)/lib/ARM9-TS $(PACKAGE_TMP)/lib/ARM9-TS; \ + $(CP) $(TWL_IPL_RED_ROOT)/lib $(PACKAGE_TMP)/lib; \ $(CP) $(TWL_IPL_RED_ROOT)/include $(PACKAGE_TMP)/include; \ $(CP) $(TWL_IPL_RED_ROOT)/components $(PACKAGE_TMP)/components; \ - mkdir -p $(PACKAGE_TMP)/build; \ $(CP) $(TWL_IPL_RED_ROOT)/build/buildtools $(PACKAGE_TMP)/build/buildtools; \ $(FIND) $(PACKAGE_TMP) -name ".svn" -a -type d -print -prune -exec $(RM) $(VERBOSE) {} \; zip -r $(ARCHIVE_ROOT)/$(ARCHIVE) $(PACKAGE_TMP) + #===== End of Makefile ===== diff --git a/build/tests/UjiPackage/readme.txt b/build/tests/UjiPackage/readme.txt index 1089f2d3..cab3a928 100644 --- a/build/tests/UjiPackage/readme.txt +++ b/build/tests/UjiPackage/readme.txt @@ -1,11 +1,7 @@ 製品技術部検査プログラム用TwlIPLパッケージ作成Makefile ■作り方 - -1. Fullビルドを行う -$ make full - -2. packageターゲットを指定してmake +1. packageターゲットを指定してmake $ make package TwlIPL-uji-(日付)-(時間).zip がこのディレクトリに生成されます。